From 4b841efed245ca8889e9da1dc4f3c4878340f005 Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 25 May 2019 01:16:38 +0200 Subject: [PATCH] fix potential oob --- lib/loader/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/loader/index.js b/lib/loader/index.js index 014d1f39..f0a1e261 100644 --- a/lib/loader/index.js +++ b/lib/loader/index.js @@ -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;