[INFER] Avoid (unreachable) integer overflow when setting holes in dense arrays, bug 642592.

This commit is contained in:
Brian Hackett 2011-03-19 10:31:36 -07:00
parent 545818365f
commit 55652ce0ff
2 changed files with 8 additions and 2 deletions

View File

@ -0,0 +1,2 @@
var strings = new Array();
strings[0x7fffffff] = 0;

View File

@ -1095,8 +1095,12 @@ IsCacheableSetElem(FrameEntry *obj, FrameEntry *id, FrameEntry *value)
return false;
if (id->isNotType(JSVAL_TYPE_INT32))
return false;
if (id->isConstant() && id->getValue().toInt32() < 0)
if (id->isConstant()) {
if (id->getValue().toInt32() < 0)
return false;
if (id->getValue().toInt32() + 1 < 0) // watch for overflow in hole paths
return false;
}
// obj[obj] * is not allowed, since it will never optimize.
// obj[id] = id is allowed.