-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Parse Type1 font files to determine the various Length{n}
properties, instead of trusting the PDF file (issue 5686, issue 3928)
#7066
Parse Type1 font files to determine the various Length{n}
properties, instead of trusting the PDF file (issue 5686, issue 3928)
#7066
Conversation
@brendandahl Can you please provide feedback on the general direction of this patch (so that I know if it's worthwhile to continue working on it)? /botio-windows preview |
General direction looks good. It may be worth looking at freetype within pdfium to see how they handle this case as well. |
Disclamer: My knowledge of C isn't what it should be, so I might be misunderstanding the code, but from a cursory look through the
Again, I might not understand the FreeType code correctly! But if the above is approximately correct, it looks to me that this PR is doing something that is at least similar. |
/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/697ac99d901da82/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/697ac99d901da82/output.txt Total script time: 0.95 mins Published |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/b0ecdc4a095d159/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/58e31eff3d81724/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/b0ecdc4a095d159/output.txt Total script time: 19.88 mins
|
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/58e31eff3d81724/output.txt Total script time: 23.76 mins
Image differences available at: http://107.21.233.14:8877/58e31eff3d81724/reftest-analyzer.html#web=eq.log |
/botio-linux test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/d12f941a2151932/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/d12f941a2151932/output.txt Total script time: 21.89 mins
|
|
||
var actualLength = 0; | ||
while (true) { | ||
var scanBytes = stream.peekBytes(headerBytesLength); |
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.
headerBytesLength
is potentially undefined here, is that okay?
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.
Yes, it's fine, since undefined
just means that we'll get the entire stream. See the comment at https://github.com/mozilla/pdf.js/pull/7066/files#diff-d9f16d4d656cd2e962e0ad032dfba903R3681.
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.
Actually, it seems kind of dumb to get the entire stream at once like that, since the header usually isn't that long compared to the total length of a Type1 font file.
So I've pushed a new version of the patch, that searches the stream in smaller chunks instead.
*Note:* Ignoring whitespace should simplify reviewing a great deal.
…s, instead of trusting the PDF file (issue 5686, issue 3928) Fixes 5686. Fixes 3928.
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/ca23ca71aa97fc8/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/167e8522b655cb7/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/167e8522b655cb7/output.txt Total script time: 19.91 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/ca23ca71aa97fc8/output.txt Total script time: 21.87 mins
|
/botio makeref |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/5ca7ff768090e79/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/2979a5d01841be9/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/2979a5d01841be9/output.txt Total script time: 20.13 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/5ca7ff768090e79/output.txt Total script time: 21.55 mins
|
Make
Type1Font
more class-like, by adding closureParse Type1 font files to determine the various
Length{n}
properties, instead of trusting the PDF file (issue 5686, issue 3928)