mirror of
https://github.com/bellard/quickjs.git
synced 2025-11-15 10:12:14 +03:00
Fix use-after-free in ArrayBuffer.prototype.transfer (bnoordhuis) (#450) - use js_array_buffer_update_typed_arrays() in JS_DetachArrayBuffer()
This commit is contained in:
@@ -511,6 +511,14 @@ function test_typed_array()
|
||||
assert(a.toString(), "1,2,3,4");
|
||||
a.set([10, 11], 2);
|
||||
assert(a.toString(), "1,2,10,11");
|
||||
|
||||
// https://github.com/quickjs-ng/quickjs/issues/1208
|
||||
buffer = new ArrayBuffer(16);
|
||||
a = new Uint8Array(buffer);
|
||||
a.fill(42);
|
||||
assert(a[0], 42);
|
||||
buffer.transfer();
|
||||
assert(a[0], undefined);
|
||||
}
|
||||
|
||||
/* return [s, line_num, col_num] where line_num and col_num are the
|
||||
|
||||
Reference in New Issue
Block a user