Files
sausage/userland/qjs/source/tests/bug1305.js
T
surma d44f1d9677 Build separate native and WASI pipelines with shared multicall names
Checkpoint before integration and package validation.

Assisted-by: SurmAgent:unknown [read] [edit] [bash]
2026-11-12 09:36:27 +00:00

27 lines
602 B
JavaScript

import {assert} from "./assert.js"
const rab = new ArrayBuffer(10, { maxByteLength: 10 });
const src = new Uint8Array(rab, 0);
function f() {
return 1337;
}
const EvilConstructor = new Proxy(function(){}, {
get: function(target, prop, receiver) {
if (prop === 'prototype') {
print("resizing");
rab.resize(0);
return Uint8Array.prototype;
}
return Reflect.get(target, prop, receiver);
}
});
try {
let u8 = Reflect.construct(Uint8Array, [src], EvilConstructor);
print(u8);
} catch (e) {
assert(e instanceof RangeError);
}