-
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
Fix loading of fonts with empty font files (bug 866395 and issue 3522) #4809
Conversation
@@ -2204,7 +2204,13 @@ var Font = (function FontClosure() { | |||
this.defaultVMetrics = properties.defaultVMetrics; | |||
} | |||
|
|||
if (!file) { | |||
if (!file || file.isEmpty) { | |||
if (!!file) { |
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.
nit: if (file) {
will look as good
I think it looks good now. Could you add one isEmpty to the https://github.com/mozilla/pdf.js/blob/master/src/core/chunked_stream.js ? |
Done, done and done; thanks for the very quick review! /botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/dd69a61069a4f0f/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/7481e1ac1fcc1a1/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/dd69a61069a4f0f/output.txt Total script time: 2.81 mins
Image differences available at: http://107.22.172.223:8877/dd69a61069a4f0f/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/7481e1ac1fcc1a1/output.txt Total script time: 25.99 mins
|
/botio-windows test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/1c67e0381b4251e/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/1c67e0381b4251e/output.txt Total script time: 23.60 mins
|
/botio makeref |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/da6ef04bf008ec7/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/c7974e8012af51c/output.txt |
Thank you for the patch |
Fix loading of fonts with empty font files (bug 866395 and issue 3522)
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/c7974e8012af51c/output.txt Total script time: 23.87 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/da6ef04bf008ec7/output.txt Total script time: 26.25 mins
|
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=866395.
Fixes #3522.
I've struggled with the best way to create the
isEmpty
property for theDecodeStream
. The first idea, to check ifpeekBytes(1)
returns data won't work at the end of the stream. Furthermore just checking ifthis.buffer
is null or empty won't work either, because ifensureBuffer
has been called that no longer holds even if the stream was actually empty. The only remaining (simple) approach seem to be to read enough of the stream and then check ifthis.bufferLength === 0
, since that should only happen when the stream is actually empty.If the current approach used in this PR isn't any good, we might instead do something along these lines:
@yurydelendik Which solution do you prefer?