mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-08 10:01:53 +00:00
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.
11 lines
433 B
HTML
11 lines
433 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
const array = new Uint8Array(16);
|
|
array.fill(0x41);
|
|
crypto.getRandomValues(new Uint8Array(array.buffer, 2, 8));
|
|
println(`Is first 2 bytes still 0x41? ${array.slice(0, 2).every(value => value === 0x41)}`);
|
|
println(`Is last 6 bytes still 0x41? ${array.slice(10).every(value => value === 0x41)}`);
|
|
});
|
|
</script>
|