Skip to content

Commit a4e5857

Browse files
MaxGraeydcodeIO
authored andcommitted
Fix missing clear to all zeros when constructing a new ArrayBufferView (AssemblyScript#669)
1 parent 27d6efa commit a4e5857

17 files changed

+4302
-3796
lines changed

std/assembly/arraybuffer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export abstract class ArrayBufferView {
1313
protected constructor(length: i32, alignLog2: i32) {
1414
if (<u32>length > <u32>BLOCK_MAXSIZE >>> alignLog2) throw new RangeError(E_INVALIDLENGTH);
1515
var buffer = __alloc(length = length << alignLog2, idof<ArrayBuffer>());
16+
memory.fill(buffer, 0, <usize>length);
1617
this.data = changetype<ArrayBuffer>(buffer); // retains
1718
this.dataStart = buffer;
1819
this.dataLength = length;

0 commit comments

Comments
 (0)