mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-24 12:11:50 +00:00
Fix missing clear to all zeros when constructing a new ArrayBufferView (#669)
This commit is contained in:
@ -13,6 +13,7 @@ export abstract class ArrayBufferView {
|
||||
protected constructor(length: i32, alignLog2: i32) {
|
||||
if (<u32>length > <u32>BLOCK_MAXSIZE >>> alignLog2) throw new RangeError(E_INVALIDLENGTH);
|
||||
var buffer = __alloc(length = length << alignLog2, idof<ArrayBuffer>());
|
||||
memory.fill(buffer, 0, <usize>length);
|
||||
this.data = changetype<ArrayBuffer>(buffer); // retains
|
||||
this.dataStart = buffer;
|
||||
this.dataLength = length;
|
||||
|
Reference in New Issue
Block a user