-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Ensure that saveDocument
works if there's no /ID-entry in the PDF document (issue 13279)
#13280
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
Ensure that saveDocument
works if there's no /ID-entry in the PDF document (issue 13279)
#13280
Conversation
b291916
to
c26bd93
Compare
/botio unittest |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/465cc8eedaa7168/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://3.101.106.178:8877/f2f3197a777e4e4/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/465cc8eedaa7168/output.txt Total script time: 3.62 mins
|
From: Bot.io (Windows)SuccessFull output at http://3.101.106.178:8877/f2f3197a777e4e4/output.txt Total script time: 5.65 mins
|
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/593b794c2d6eccf/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://3.101.106.178:8877/5cfeb2e261cfbf3/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/593b794c2d6eccf/output.txt Total script time: 3.69 mins
|
From: Bot.io (Windows)SuccessFull output at http://3.101.106.178:8877/5cfeb2e261cfbf3/output.txt Total script time: 5.66 mins
|
While PDF documents without /ID is quite rare, as the issue shows they unfortunately do exist. |
…ocument (issue 13279) First of all, while it should be very unlikely that the /ID-entry is an *indirect* object, note how we're using `Dict.get` when parsing it e.g. in `PDFDocument.fingerprint`. Hence we definitely should be consistent here, since if the /ID-entry is an *indirect* object the existing code in `src/core/writer.js` would already fail. Secondly, to fix the referenced issue, we also need to check that the /ID-entry actually is an Array before attempting to access its contents in `src/core/writer.js`. *Drive-by change:* In the `xrefInfo` object passed to the `incrementalUpdate` function, re-name the `encrypt` property to `encryptRef` since its data is fetched using `Dict.getRaw` (given the names of the other properties fetched similarly).
c26bd93
to
2bde8b0
Compare
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.
LGTM, thanks for doing this.
First of all, while it should be very unlikely that the /ID-entry is an indirect object, note how we're using
Dict.get
when parsing it e.g. inPDFDocument.fingerprint
. Hence we definitely should be consistent here, since if the /ID-entry is an indirect object the existing code insrc/core/writer.js
would already fail.Secondly, to fix the referenced issue, we also need to check that the /ID-entry actually is an Array before attempting to access its contents in
src/core/writer.js
.Drive-by change: In the
xrefInfo
object passed to theincrementalUpdate
function, re-name theencrypt
property toencryptRef
since its data is fetched usingDict.getRaw
(given the names of the other properties fetched similarly).Fixes #13279