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 MurmurHash3_64.update handles ArrayBuffer input correctly, to avoid hash-collisions (issue 12533) #12534

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

Snuffleupagus
Copy link
Collaborator

Different fonts incorrectly end up with identical hashes, despite having different /ToUnicode data.
The issue, and it's very interesting that we've apparently not seen it before, appears to be caused by the fact that different /ToUnicode entries share the same underlying ArrayBuffer, which thus becomes problematic at the const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts); line. The simplest solution thus seem to be to just copy the input, when it's an ArrayBuffer, rather than using it as-is. (Note that if we'd stringified the input, when calling MurmurHash3_64.update, the issue would also have been fixed. In this case, we're already creating an unique TypedArray.)

Fixes #12533

…ctly, to avoid hash-collisions (issue 12533)

Different fonts incorrectly end up with *identical* hashes, despite having different /ToUnicode data.
The issue, and it's very interesting that we've apparently not seen it before, appears to be caused by the fact that different /ToUnicode entries share the *same* underlying `ArrayBuffer`, which thus becomes problematic at the `const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);` line. The simplest solution thus seem to be to just *copy* the input, when it's an `ArrayBuffer`, rather than using it as-is. (Note that if we'd stringified the input, when calling `MurmurHash3_64.update`, the issue would also have been fixed. In this case, we're already creating an unique TypedArray.)
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/4ff5106137b8d70/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/4ff5106137b8d70/output.txt

Total script time: 3.91 mins

Published

@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/5ff6ae427aa90dd/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/5ff6ae427aa90dd/output.txt

Total script time: 25.87 mins

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

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

@timvandermeij timvandermeij merged commit 71a14be into mozilla:master Oct 26, 2020
@timvandermeij
Copy link
Contributor

Nice find; that's a really interesting one!

/botio-linux makeref

@pdfjsbot
Copy link

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/1fc654d81162cb8/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/1fc654d81162cb8/output.txt

Total script time: 23.83 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Large characters rendered overlapping on PDF.js in Firefox 82
3 participants