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

Ensure that the empty dictionary won't be accidentally modified, and slightly improve the "SaveDocument" handler in src/core/worker.js #12375

Merged
merged 2 commits into from
Sep 15, 2020

Conversation

Snuffleupagus
Copy link
Collaborator

  • Ensure that the empty dictionary won't be accidentally modified

    Currently there's nothing that prevents modification of the Dict.empty primitive, which obviously needs to be truly empty to prevent any future (hard to find) bugs.

  • A couple of small improvements in the "SaveDocument" handler in src/core/worker.js

    • Check that the "Info"-entry, in the XRef-trailer, is actually a dictionary before accessing it. This is similar to the PDFDocument.documentInfo method and follows the general principal of validating data carefully before accessing it, given how often PDF-software may create corrupt PDF files.

    • Slightly simplify the "XFA"-lookup, since there's no point in trying to fetch something from the empty dictionary.

Currently there's nothing that prevents modification of the `Dict.empty` primitive, which obviously needs to be *truly* empty to prevent any future (hard to find) bugs.
…core/worker.js`

 - Check that the "Info"-entry, in the XRef-trailer, is actually a dictionary before accessing it. This is similar to the `PDFDocument.documentInfo` method and follows the general principal of validating data carefully before accessing it, given how often PDF-software may create corrupt PDF files.

 - Slightly simplify the "XFA"-lookup, since there's no point in trying to fetch something from the empty dictionary.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/f9f417c06af9735/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/6f68169877217d4/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/f9f417c06af9735/output.txt

Total script time: 27.22 mins

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/6f68169877217d4/output.txt

Total script time: 29.76 mins

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

Image differences available at: http://54.215.176.217:8877/6f68169877217d4/reftest-analyzer.html#web=eq.log

@timvandermeij timvandermeij changed the title Ensure that the empty dictionary won't be accidentally modified, and slighly improve the "SaveDocument" handler in src/core/worker.js Ensure that the empty dictionary won't be accidentally modified, and slightly improve the "SaveDocument" handler in src/core/worker.js Sep 15, 2020
@timvandermeij timvandermeij merged commit 374aad7 into mozilla:master Sep 15, 2020
@timvandermeij
Copy link
Contributor

Looks good!

@Snuffleupagus Snuffleupagus deleted the emptyDict-set branch September 16, 2020 07:06
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