You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears Acrobat will render pdf files properly even when object/stream def after %%EOF, however peepdf will discard the content due to stop at %%EOF.
e.g: the recent hot pdf exploit, bd23ad33accef14684d42c32769092a0
0000023515 00000 n
0000024187 00000 n
0000024261 00000 n
trailer
<<
/Size 67
/Root 10 0 R
>>
startxref
24613
%%EOF
1 0 obj
<<
/Length 56305
/Filter /FlateDecode
>>
stream
....
Current peepdf will failed to parse, throws exception.
The following tries to fix the problem.
diff --git a/PDFCore.py b/PDFCore.py
index 3b2fe00..33cf5a4 100644
--- a/PDFCore.py
+++ b/PDFCore.py
@@ -4315,7 +4315,7 @@ class PDFBody :
self.setObject(compressedId, compressedObject, offset)
del(compressedObjectsDict)
for id in self.referencedJSObjects:
- if id not in self.containingJS:
+ if (len(self.containingJS) and id not in self.containingJS):
object = self.objects[id].getObject()
if object == None:
errorMessage = 'Object is None'
@@ -6941,6 +6941,9 @@ class PDFParser :
self.fileParts.append(fileContent)
else:
sys.exit(errorMessage)
+ # append anything behind %%EOF
+ if fileContent:
+ self.fileParts.append(fileContent)
pdfFile.setUpdates(len(self.fileParts) - 1)
# Getting the body, cross reference table and trailer of each part of the file
Applying the change, there should be no issue of parsing said file:
Thanks @binjo! I want to merge first everything from a fork which is more active right now than master, I will try to do this fast, but I need to do some testing before. It is curious that having an isolated object really works with Adobe Reader, I am quite sure I read all the specification years ago, or if was not documented or they changed something...:?
It appears Acrobat will render pdf files properly even when object/stream def after %%EOF, however peepdf will discard the content due to stop at %%EOF.
e.g: the recent hot pdf exploit, bd23ad33accef14684d42c32769092a0
Current peepdf will failed to parse, throws exception.
The following tries to fix the problem.
Applying the change, there should be no issue of parsing said file:
It's a quick fix, you may refactor the logic a bit...
The text was updated successfully, but these errors were encountered: