Avoid recursive death due to JS1.2 toString=>toSource combined with after-the-fact, heretofore unversioned reflection of string chars as enumerable elements (271477, r=jband).

This commit is contained in:
brendan%mozilla.org 2004-11-25 00:55:01 +00:00
parent 8073e345f4
commit 3fed695bed

View File

@ -529,6 +529,10 @@ str_enumerate(JSContext *cx, JSObject *obj)
JSString *str, *str1;
size_t i, length;
/* Avoid infinite recursion via js_obj_toSource (see bug 271477). */
if (cx->version == JSVERSION_1_2)
return JS_TRUE;
str = js_ValueToString(cx, OBJECT_TO_JSVAL(obj));
if (!str)
return JS_FALSE;