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

Bugfix: passing an object to JS_ValueToInt32() apparently causes the JS engine

to crash, so test arg (to File.open() with JSVAL_IS_NUMBER() first.
parent 8d5e3b7c
Branches
Tags
No related merge requests found
...@@ -149,7 +149,7 @@ js_open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) ...@@ -149,7 +149,7 @@ js_open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
mode=JS_GetStringBytes(str); mode=JS_GetStringBytes(str);
} else if(JSVAL_IS_BOOLEAN(argv[i])) /* shareable */ } else if(JSVAL_IS_BOOLEAN(argv[i])) /* shareable */
shareable=JSVAL_TO_BOOLEAN(argv[i]); shareable=JSVAL_TO_BOOLEAN(argv[i]);
else /* bufsize */ else if(JSVAL_IS_NUMBER(argv[i])) /* bufsize */
JS_ValueToInt32(cx,argv[i],&bufsize); JS_ValueToInt32(cx,argv[i],&bufsize);
} }
SAFECOPY(p->mode,mode); SAFECOPY(p->mode,mode);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment