Skip to content
Snippets Groups Projects
Commit a874f7e8 authored by rswindell's avatar rswindell
Browse files

Fix 2 different possible load() crashes: if a scope object was specified, but

no script filename, or if a *function* object was specified for the scope
object.
parent 27fe3485
No related branches found
No related tags found
No related merge requests found
......@@ -296,9 +296,16 @@ js_load(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
exec_cx = bg->cx;
exec_obj = bg->obj;
} else if(JSVAL_IS_OBJECT(argv[argn])) /* Scope specified */
exec_obj=JSVAL_TO_OBJECT(argv[argn++]);
} else if(JSVAL_IS_OBJECT(argv[argn])) {
JSObject* tmp_obj=JSVAL_TO_OBJECT(argv[argn++]);
if(!JS_ObjectIsFunction(cx,tmp_obj)) /* Scope specified */
exec_obj=tmp_obj;
}
if(argn==argc) {
JS_ReportError(cx,"no filename specified");
return(JS_FALSE);
}
if((filename=js_ValueToStringBytes(cx, argv[argn++], NULL))==NULL)
return(JS_FALSE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment