-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF-Hul: Bug in skipIISBytes and PdfModule.getObject #151
Conversation
…e-#82 FIX - Update README post v1.14
…d test PDF to demonstrate this.
Current coverage is 3.43% (diff: 0.00%)
|
…d from an object stream. This resulted in Improperly constructed page tree errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
return ostrm.getObject (objIndex); | ||
/* Need to ensure the object number is set */ | ||
PdfObject obj = ostrm.getObject (objIndex); | ||
obj.setObjNumber (objIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting the object number can be safely moved into the ObjectStream.getObject()
method for the benefit of any other callers.
This is fixed by #188 |
Many documents returning Invalid Page Dictionary Object seem to be the result of a bug in PdfFlateInputStream.skipIISBytes which is miscalculating the number of bytes to skip when the requested skip number is larger than the remaining buffer size.
In particular, this seems to relate to Page Trees encoded in stream objects where the root page starts beyond one buffer's worth of data.
The added InvalidPageDictionary.pdf file exemplifies this problem.
Note solving this problem results in "Improperly Constructed Page Tree" being returned by JHOVE. This seems to be being caused by JHOVE not correctly setting the object index for objects extracted from streams, meaning that when PageTreeNode.nextPageObject (line 197) tries to check if it's already visited a node, it fails (essentially it compares index -1 to index -1).