aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-26 17:05:07 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-02-26 17:05:07 -0500
commit2f5e6f993e1b1a446331520b4dc2d5b19d597371 (patch)
tree970e5a6e77c2540f7e9459bd7fc0df1681eff46b /src/jsifier.js
parent0e51f92d800dac9e697a8488c36b62e23bdb0d76 (diff)
SAFE_DYNCALLS option
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 5f327076..ff43c8c6 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1401,6 +1401,8 @@ function JSify(data, functionsOnly, givenFunctions) {
if (ASM_JS) {
assert(returnType.search(/\("'\[,/) == -1); // XXX need isFunctionType(type, out)
callIdent = '(' + callIdent + ')&{{{ FTM_' + sig + ' }}}'; // the function table mask is set in emscripten.py
+ } else if (SAFE_DYNCALLS) {
+ callIdent = '(tempInt=' + callIdent + ',tempInt < 0 || tempInt >= FUNCTION_TABLE.length-1 ? abort("dyncall error") : tempInt)';
}
callIdent = Functions.getTable(sig) + '[' + callIdent + ']';
}