aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-04-24 16:52:27 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-04-24 17:46:17 -0700
commit0689e43ae61723dde87ec9a2b6210a349d080b31 (patch)
treec889633c6c7630df5d3423c1d8e40e8a648edd55 /src
parent13f1516d15c72fe3b2a6ea70a2ab643f1eedd825 (diff)
check function table masks in safe heap mode
Diffstat (limited to 'src')
-rw-r--r--src/preamble.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 89ab5026..5dd8ada1 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -207,6 +207,14 @@ function SAFE_HEAP_LOAD(dest, bytes, isFloat, unsigned) {
return ret;
}
+function SAFE_FT_MASK(value, mask) {
+ var ret = value & mask;
+ if (ret !== value) {
+ abort('Function table mask error: function pointer is ' + value + ' which is masked by ' + mask + ', the likely cause of this is that the function pointer is being called by the wrong type.');
+ }
+ return ret;
+}
+
#endif
#endif