Fix missing clear to all zeros when constructing a new ArrayBufferView (#669)

This commit is contained in:
Max Graey
2019-06-15 02:00:49 +03:00
committed by Daniel Wirtz
parent 27d6efa037
commit a4e5857f7f
17 changed files with 3096 additions and 2590 deletions

View File

@ -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;