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

fix: disable resizable ArrayBuffer and growable SharedArrayBuffer #18395

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions core/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ fn v8_init(
" --no-validate-asm",
" --turbo_fast_api_calls",
" --harmony-change-array-by-copy",
" --no-harmony-rab-gsab",
);

if predictable {
Expand Down Expand Up @@ -4874,6 +4875,25 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", {
.is_ok());
}

#[test]
fn test_resizable_array_buffer() {
// Verify that "resizable ArrayBuffer" is disabled
let mut runtime = JsRuntime::new(Default::default());
runtime
.execute_script(
"test_rab.js",
r#"const a = new ArrayBuffer(100, {maxByteLength: 200});
if (a.byteLength !== 100) {
throw new Error('wrong byte length');
}
if (a.maxByteLength !== undefined) {
throw new Error("ArrayBuffer shouldn't have maxByteLength");
}
"#,
)
.unwrap();
}

#[tokio::test]
async fn cant_load_internal_module_when_snapshot_is_loaded_and_not_snapshotting(
) {
Expand Down