From cb877f31cd61716774d5d3f532bf6082bdcf4162 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 7 Feb 2014 10:25:15 -0500 Subject: improve safe heap tests in asm mode --- src/preamble.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/preamble.js') diff --git a/src/preamble.js b/src/preamble.js index 9a65b092..25ef1fb3 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -188,6 +188,8 @@ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { #endif assert(dest > 0, 'segmentation fault'); assert(dest % bytes === 0); + assert(dest < Math.max(DYNAMICTOP, STATICTOP)); + assert(DYNAMICTOP <= TOTAL_MEMORY); setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); } @@ -197,6 +199,8 @@ function SAFE_HEAP_LOAD(dest, bytes, isFloat, unsigned) { #endif assert(dest > 0, 'segmentation fault'); assert(dest % bytes === 0); + assert(dest < Math.max(DYNAMICTOP, STATICTOP)); + assert(DYNAMICTOP <= TOTAL_MEMORY); var type = getSafeHeapType(bytes, isFloat); var ret = getValue(dest, type, 1); if (unsigned) ret = unSign(ret, parseInt(type.substr(1)), 1); -- cgit v1.2.3-18-g5258