Skip to content

Only skip parsing a stream in Parser_makeFilter when we know for sure that it is empty (PR 6372 follow-up) #7670

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

Merged
merged 1 commit into from
Oct 5, 2016
Merged

Only skip parsing a stream in Parser_makeFilter when we know for sure that it is empty (PR 6372 follow-up) #7670

merged 1 commit into from
Oct 5, 2016

Conversation

Snuffleupagus
Copy link
Collaborator

For PDF files with multiple /Filters, where the /Length entry is zero, we fail to render the file correctly. The reason is that maybeLength is null for the every filter except the first, and !maybeLength is thus truthy.
Hence it seems that we should completely ignore the /Length entry and also explicitly check maybeLength === 0.

Note that I've not (yet) come across a PDF file with this issue in the wild, but given all the stupid things PDF generators do I wouldn't be surprised if such a file actually exists. In order to prevent a possible future bug, I'm submitting this patch which includes a hand-edited PDF file that we currently cannot render correctly (but e.g. Adobe Reader can).

…re that it is empty (PR 6372 follow-up)

For PDF files with multiple `/Filter`s, where the `/Length` entry is zero, we fail to render the file correctly. The reason is that `maybeLength` is `null` for the every filter except the first, and `!maybeLength` is thus truthy.
Hence it seems that we should completely ignore the `/Length` entry and also explicitly check `maybeLength === 0`.

Note that I've not (yet) come across a PDF file with this issue in the wild, but given all the stupid things PDF generators do I wouldn't be surprised if such a file actually exists. In order to prevent a possible future bug, I'm submitting this patch which includes a hand-edited PDF file that we currently cannot render correctly (but e.g. Adobe Reader can).
@Snuffleupagus
Copy link
Collaborator Author

/botio test

1 similar comment
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.22.172.223:8877/122f62dad532b89/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/c1ac9ecc029804b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/122f62dad532b89/output.txt

Total script time: 25.28 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.22.172.223:8877/122f62dad532b89/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/c1ac9ecc029804b/output.txt

Total script time: 28.34 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.21.233.14:8877/c1ac9ecc029804b/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator Author

I've opened https://bugzilla.mozilla.org/show_bug.cgi?id=1305963 for the regression in the issue6165 test. Hence I believe that this PR should be good to go.

@Snuffleupagus
Copy link
Collaborator Author

I've opened https://bugzilla.mozilla.org/show_bug.cgi?id=1305963 for the regression in the issue6165 test. Hence I believe that this PR should be good to go.

The upstream bug has now been fixed! However, it's not been uplifted to Firefox 51 yet, but again I don't think that needs to hold off landing this PR.

Copy link
Contributor

@yurydelendik yurydelendik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch.

@yurydelendik
Copy link
Contributor

/botio makeref

@pdfjsbot
Copy link

pdfjsbot commented Oct 5, 2016

From: Bot.io (Linux)


Received

Command cmd_makeref from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/7750eb212e778f3/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 5, 2016

From: Bot.io (Windows)


Received

Command cmd_makeref from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/b52b0e5ab7a5dc0/output.txt

@yurydelendik yurydelendik merged commit 7b2a9ee into mozilla:master Oct 5, 2016
@pdfjsbot
Copy link

pdfjsbot commented Oct 5, 2016

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/b52b0e5ab7a5dc0/output.txt

Total script time: 25.19 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

pdfjsbot commented Oct 5, 2016

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/7750eb212e778f3/output.txt

Total script time: 27.43 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@Snuffleupagus Snuffleupagus deleted the Parser_makeFilter-maybeLength branch October 5, 2016 16:05
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…maybeLength

Only skip parsing a stream in `Parser_makeFilter` when we know for sure that it is empty (PR 6372 follow-up)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants