Skip to content
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 PDF files with invalid or missing Type3 characters (issue 5039) #5077

Merged
merged 1 commit into from
Jul 25, 2014
Merged

Fix loading of PDF files with invalid or missing Type3 characters (issue 5039) #5077

merged 1 commit into from
Jul 25, 2014

Conversation

Snuffleupagus
Copy link
Collaborator

Fixes #5039.

This PR actually addresses two different Type3 issues:

  • The case described in the issue, where we're unable to load all font resources because of invalid data.
    In the file in the issue, the offending font resource is the one for the "space" character. If we just catch the Promise rejection (in evaluator.js) all pages would finish rendering.
    However there would be no spaces present between words, which is thus solved by adding an empty OperatorList to the charProcOperatorList array.
  • To fix the issue referenced above, the changes in evaluator.js is actually enough.
    But when I created the test case, I accidentally stumbled on another issue: if a showText command for a Type3 font contains a reference to a character not present in the font, the page won't finish rendering. Hence the changes to canvas.js to address this, hopefully rare, case.

@timvandermeij
Copy link
Contributor

Nice work, I can confirm the fix.

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/8caebec31111cc5/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/8caebec31111cc5/output.txt

Total script time: 21.40 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

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

Total script time: 23.50 mins

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

@yurydelendik
Copy link
Contributor

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/237f1aeaf345b4b/output.txt

yurydelendik added a commit that referenced this pull request Jul 25, 2014
Fix loading of PDF files with invalid or missing Type3 characters (issue 5039)
@yurydelendik yurydelendik merged commit 1e21bac into mozilla:master Jul 25, 2014
@yurydelendik
Copy link
Contributor

Thank you for the patch

@Snuffleupagus Snuffleupagus deleted the issue-5039 branch July 25, 2014 19:38
@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/237f1aeaf345b4b/output.txt

Total script time: 21.41 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

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

Total script time: 23.46 mins

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Patobook is not rendered correctly
4 participants