Protect against scripts setting __proto__ to null. bug 317250, hopeful-r=brendan

This commit is contained in:
mrbkap%gmail.com 2006-03-23 02:24:45 +00:00
Родитель 1c51b97da1
Коммит 004d9520d6
1 изменённых файлов: 10 добавлений и 8 удалений

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

@ -189,14 +189,16 @@ obj_setSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
return JS_TRUE; return JS_TRUE;
pobj = JSVAL_TO_OBJECT(*vp); pobj = JSVAL_TO_OBJECT(*vp);
/* if (pobj) {
* Innerize pobj here to avoid sticking unwanted properties on the outer /*
* object. This ensures that any with statements only grant access to the * Innerize pobj here to avoid sticking unwanted properties on the outer
* inner object. * object. This ensures that any with statements only grant access to the
*/ * inner object.
OBJ_TO_INNER_OBJECT(cx, pobj); */
if (!pobj) OBJ_TO_INNER_OBJECT(cx, pobj);
return JS_FALSE; if (!pobj)
return JS_FALSE;
}
slot = (uint32) JSVAL_TO_INT(id); slot = (uint32) JSVAL_TO_INT(id);
if (JS_HAS_STRICT_OPTION(cx) && !ReportStrictSlot(cx, slot)) if (JS_HAS_STRICT_OPTION(cx) && !ReportStrictSlot(cx, slot))
return JS_FALSE; return JS_FALSE;