aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-07 12:02:47 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-07 12:02:47 -0800
commit04b5c9d3d434e1bf6ab0dab42fd27fd4a4dd0721 (patch)
tree01c0223e26b31cfbb3dfb79dbb709dcebac2602d /src/parseTools.js
parentf034e3928783ff7a6491833f358c51cfb082b197 (diff)
properly overflow gep arguments; fixes #1975
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 22e9b94c..cef25ed4 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1640,7 +1640,10 @@ function getFastValue(a, op, b, type) {
}
function getFastValues(list, op, type) {
- assert(op == '+');
+ assert(op === '+' && type === 'i32');
+ for (var i = 0; i < list.length; i++) {
+ if (isNumber(list[i])) list[i] = (list[i]|0) + '';
+ }
var changed = true;
while (changed) {
changed = false;
@@ -1648,6 +1651,7 @@ function getFastValues(list, op, type) {
var fast = getFastValue(list[i], op, list[i+1], type);
var raw = list[i] + op + list[i+1];
if (fast.length < raw.length || fast.indexOf(op) < 0) {
+ if (isNumber(fast)) fast = (fast|0) + '';
list[i] = fast;
list.splice(i+1, 1);
i--;