From 30a4b3d7fba78421aaf9e6b11e6c8b399eacced2 Mon Sep 17 00:00:00 2001 From: Kobi Gurkan Date: Tue, 14 May 2019 09:53:56 +0300 Subject: [PATCH] Make memory grow on overflowing allocation --- src/groth16.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/groth16.js b/src/groth16.js index cc0f647..7af0d5c 100644 --- a/src/groth16.js +++ b/src/groth16.js @@ -68,6 +68,10 @@ function thread(self) { while (i32[0] & 3) i32[0]++; // Return always aligned pointers const res = i32[0]; i32[0] += length; + while (i32[0] > memory.buffer.byteLength) { + memory.grow(100); + } + i32 = new Uint32Array(memory.buffer); return res; }