fix potential oob

This commit is contained in:
dcode 2019-05-25 01:16:38 +02:00
parent c34ed66fd9
commit 4b841efed2

View File

@ -176,7 +176,7 @@ function postInstantiate(baseModule, instance) {
const align = getAlign(VAL_ALIGN, info);
const length = values.length;
const buf = alloc(length << align, ARRAYBUFFER_ID);
const arr = alloc(ARRAYBUFFERVIEW_SIZE, id);
const arr = alloc(info & ARRAY ? ARRAY_SIZE : ARRAYBUFFERVIEW_SIZE, id);
checkMem();
U32[arr + ARRAYBUFFERVIEW_BUFFER_OFFSET >>> 2] = retain(buf);
U32[arr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2] = buf;