Bug 345967: ensure proper id rooting in array_unshift. r=mrbkap,sr=brendan

This commit is contained in:
igor.bukanov%gmail.com 2006-07-26 21:32:56 +00:00
Родитель 4697e3d83e
Коммит bd81ffee8a
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -1224,7 +1224,12 @@ array_shift(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
}
}
/* Delete the only or last element. */
/*
* Delete the only or the last element. We recreate id when it is an
* atom to protect against a nested GC during the last iteration.
*/
if (length > JSVAL_INT_MAX && !IndexToId(cx, length, &id))
return JS_FALSE;
if (!OBJ_DELETE_PROPERTY(cx, obj, id, &junk))
return JS_FALSE;
}