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

[Skrifa] Avoid initialization of HashSet with system random numbers #751

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

drott
Copy link
Contributor

@drott drott commented Jan 8, 2024

Workaround for [1] and [2] - issues in the Chrome sandbox requiring access to random number generators.

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=1516634
[2] https://bugs.chromium.org/p/chromium/issues/detail?id=1516641

@drott
Copy link
Contributor Author

drott commented Jan 8, 2024

Tested in Chromium, works as a solution for https://bugs.chromium.org/p/chromium/issues/detail?id=1516634.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

Okay this makes sense.

My one concern here is that it would be easy for someone to introduce other uses of hashmap without being aware that it will break the upstream client? But I can't think of any clean way to prevent that, so I guess it will be a matter for code review.

And just as an observation, if this was a pattern we were doing a lot I might create a trait, DeterministicHash, where we could define a constructor method, so you could just call, HashSet::new_non_random() or something. Definitely not necessary, just mentioning it because it's a useful pattern to consider sometimes.

skrifa/src/color/mod.rs Outdated Show resolved Hide resolved
@drott drott merged commit eef6a26 into googlefonts:main Jan 8, 2024
7 checks passed
vigneshvg added a commit to webmproject/CrabbyAvif that referenced this pull request Jan 31, 2024
And add workaroud to use non random state for chrome on windows.

Based on googlefonts/fontations#751.
drott added a commit to drott/fontations that referenced this pull request Mar 11, 2024
…umbers (googlefonts#751)"

This reverts commit eef6a26.

See details in [1] and [2]. Rust upstream landed a change switching to a
different, sandbox-compatible call for PRNG, except on Windows
7. Windows 7 is no longer supported by Chromium. Chromium is our only
known sandboxed environment where this call would fail. Remove the
workaround.

[1] https://issues.chromium.org/40277768
[2] rust-lang/rust@08caefb
drott added a commit that referenced this pull request Mar 11, 2024
…umbers (#751)" (#825)

This reverts commit eef6a26.

See details in [1] and [2]. Rust upstream landed a change switching to a
different, sandbox-compatible call for PRNG, except on Windows
7. Windows 7 is no longer supported by Chromium. Chromium is our only
known sandboxed environment where this call would fail. Remove the
workaround.

[1] https://issues.chromium.org/40277768
[2] rust-lang/rust@08caefb
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.

2 participants