-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Make sure that an A entry in an annotation dictionary is also a dictionary itself #5684
Make sure that an A entry in an annotation dictionary is also a dictionary itself #5684
Conversation
@@ -485,7 +485,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() { | |||
data.annotationType = AnnotationType.LINK; | |||
|
|||
var action = dict.get('A'); | |||
if (action) { | |||
if (isDict(action)) { |
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.
How about if (action && isDict(action)) {
instead, to avoid doing the isDict
check if action
isn't defined?
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.
thats the first check in isDict. so what you actually only avoid is the method call to that util function. there are many more instances were we prefer the util method cal over the trivial implementation inside.
like
function isArray(v) {
return v instanceof Array;
}
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.
I agree that it would be better to avoid the function call here if possible. The commit has been updated.
1bfe268
to
06004d6
Compare
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/2ed10b36db86831/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/2ed10b36db86831/output.txt Total script time: 0.82 mins Published |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/919571647424b9c/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/c6fa37413ccf83d/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/c6fa37413ccf83d/output.txt Total script time: 2.88 mins
Image differences available at: http://107.22.172.223:8877/c6fa37413ccf83d/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/919571647424b9c/output.txt Total script time: 22.72 mins
|
Make sure that an A entry in an annotation dictionary is also a dictionary itself
Seems fine, thanks! |
Make sure that an A entry in an annotation dictionary is also a dictionary itself
Fixes #5683.
According to https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf#page=647&zoom=auto,-246,56 an
A
entry in an annotation dictionary must also be a dictionary itself. The current code just assumes that, but some (corrupted) PDFs violate that standard. This patch makes sure to check that theA
entry is actually a dictionary before trying to get properties from it (on https://github.com/mozilla/pdf.js/blob/master/src/core/annotation.js#L489 which assumes we are dealing with a valid dictionary).