mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 15:49:11 +00:00
LibWeb: Respect subarrays in Crypto#getRandomBytes
It is the responsibility of code that deals with TypedArrays to apply the byte offset and byte length. Not doing this caused Unity Web to crash, as they call getRandomValues with views into their full main memory. Previously, it would fill their entire memory of about 33.5 MB with random bytes.
This commit is contained in:
parent
30ec8c1d4d
commit
023c3aa5b0
Notes:
github-actions[bot]
2024-12-10 14:44:56 +00:00
Author: https://github.com/Lubrsi
Commit: 023c3aa5b0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2857
3 changed files with 14 additions and 1 deletions
|
@ -67,7 +67,7 @@ WebIDL::ExceptionOr<GC::Root<WebIDL::ArrayBufferView>> Crypto::get_random_values
|
|||
// FIXME: Handle SharedArrayBuffers
|
||||
|
||||
// 3. Overwrite all elements of array with cryptographically strong random values of the appropriate type.
|
||||
fill_with_random(array->viewed_array_buffer()->buffer());
|
||||
fill_with_random(array->viewed_array_buffer()->buffer().bytes().slice(array->byte_offset(), array->byte_length()));
|
||||
|
||||
// 4. Return array.
|
||||
return array;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue