From: Gwurk <gw...@fi...> - 2008-03-01 09:42:14
|
Hello, [reposting to pdfedit-devel] In xpdf/xpdf/XRef.cc, XRef::getStartXref(), you calculate the eofPos as: str->setPos(xrefSearchSize-i, -1); eofPos=str->getPos(); However, xrefSearchSize is the size of the buffer buf, and not the size of the text that was actually read. For tiny PDFs (smaller than xrefSearchSize bytes), this calculation is incorrect. The code should be corrected to say: str->setPos(n-i, -1); A test case is attached. Open smallpdf.pdf in PDFedit, make any change to it, then save it. The resulting PDF is invalid without this fix. Also, I noticed you use a for loop to manually find the "%%EOF" marker in the file. You can use the standard function strstr() instead. The attached patch contains both of these changes. Thanks! |