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

Take the W array into account when computing the hash, in PartialEvaluator.preEvaluateFont, for composite fonts (issue 13343) #13347

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

Without this some composite fonts may incorrectly end up with matching hashes, thus breaking rendering since we'll not actually try to load/parse some of the fonts.

Please note: Given that the document, in the referenced issue, doesn't embed any of its fonts there's no guarantee that it renders correctly in all configurations even with this patch.

Fixes #13343 (to the extent that doing so is possible, since the document uses non-embedded and non-standard fonts).

@Snuffleupagus Snuffleupagus force-pushed the preEvaluateFont-composite-widths branch 3 times, most recently from 145fd18 to 6bdd561 Compare May 7, 2021 10:53
@pdfjsbot
Copy link

pdfjsbot commented May 7, 2021

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/9059083e1e7d3f1/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 7, 2021

From: Bot.io (Windows)


Received

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

Live output at: http://3.101.106.178:8877/32014e1861f2ed5/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 7, 2021

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/9059083e1e7d3f1/output.txt

Total script time: 26.11 mins

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

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

@pdfjsbot
Copy link

pdfjsbot commented May 7, 2021

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/32014e1861f2ed5/output.txt

Total script time: 29.35 mins

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

Image differences available at: http://3.101.106.178:8877/32014e1861f2ed5/reftest-analyzer.html#web=eq.log

…valuator.preEvaluateFont`, for composite fonts (issue 13343)

Without this some *composite* fonts may incorrectly end up with matching `hash`es, thus breaking rendering since we'll not actually try to load/parse some of the fonts.

*Please note:* Given that the document, in the referenced issue, doesn't embed *any* of its fonts there's no guarantee that it renders correctly in all configurations even with this patch.
…n `PartialEvaluator.preEvaluateFont`

To hopefully help prevent any future bugs, make sure that composite/non-composite fonts cannot accidentally get matching `hash`es. Given the differences between those font types, that's very unlikely to be useful or even correct in general.
…or.preEvaluateFont`

*Please note:* While I don't have a document that this patches fixes, the current code is however not entirely correct as far as I can tell.

Looking at how the `Widths` array is parsed in `PartialEvaluator.extractWidths`, it's clear that the implementation in `PartialEvaluator.preEvaluateFont` is a bit too simplistic. In particular, by only wrapping the data into a TypedArray, there's no attempt to handle *indirect* objects which could potentially lead to colliding `hash`es being computed.
@Snuffleupagus Snuffleupagus force-pushed the preEvaluateFont-composite-widths branch from 6bdd561 to 8a1cb82 Compare May 7, 2021 19:23
@pdfjsbot
Copy link

pdfjsbot commented May 7, 2021

From: Bot.io (Windows)


Received

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

Live output at: http://3.101.106.178:8877/16bde13376f17c9/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 7, 2021

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/36279e8d9aedf4a/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 7, 2021

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/36279e8d9aedf4a/output.txt

Total script time: 26.06 mins

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

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

@pdfjsbot
Copy link

pdfjsbot commented May 7, 2021

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/16bde13376f17c9/output.txt

Total script time: 29.09 mins

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

Image differences available at: http://3.101.106.178:8877/16bde13376f17c9/reftest-analyzer.html#web=eq.log

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2021

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/22621a91e1755cb/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/22621a91e1755cb/output.txt

Total script time: 4.49 mins

Published

@timvandermeij timvandermeij merged commit e6435e3 into mozilla:master May 8, 2021
@timvandermeij
Copy link
Contributor

Thank you for improving this!

/botio makeref

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2021

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/8766cb37ecc72f0/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2021

From: Bot.io (Windows)


Received

Command cmd_makeref from @timvandermeij received. Current queue size: 1

Live output at: http://3.101.106.178:8877/e67b0512268bd15/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2021

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/e67b0512268bd15/output.txt

Total script time: 26.31 mins

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

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2021

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/8766cb37ecc72f0/output.txt

Total script time: 60.00 mins

  • Lint: Passed

@Snuffleupagus
Copy link
Collaborator Author

/botio-linux makeref

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2021

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/390d82b03fe90ff/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/390d82b03fe90ff/output.txt

Total script time: 22.94 mins

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

@Snuffleupagus Snuffleupagus deleted the preEvaluateFont-composite-widths branch May 8, 2021 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The text is cut off on Japanese documents.
3 participants