mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 959934. Fix unsafe address hazards in jsopcode.cpp. r=sfink
This commit is contained in:
parent
1bfb1b9283
commit
61df1e8862
@ -815,7 +815,7 @@ static char *
|
||||
QuoteString(Sprinter *sp, JSString *str, uint32_t quote);
|
||||
|
||||
static bool
|
||||
ToDisassemblySource(JSContext *cx, jsval v, JSAutoByteString *bytes)
|
||||
ToDisassemblySource(JSContext *cx, HandleValue v, JSAutoByteString *bytes)
|
||||
{
|
||||
if (JSVAL_IS_STRING(v)) {
|
||||
Sprinter sprinter(cx);
|
||||
@ -941,7 +941,8 @@ js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
}
|
||||
|
||||
case JOF_SCOPECOORD: {
|
||||
Value v = StringValue(ScopeCoordinateName(cx->runtime()->scopeCoordinateNameCache, script, pc));
|
||||
RootedValue v(cx,
|
||||
StringValue(ScopeCoordinateName(cx->runtime()->scopeCoordinateNameCache, script, pc)));
|
||||
JSAutoByteString bytes;
|
||||
if (!ToDisassemblySource(cx, v, &bytes))
|
||||
return 0;
|
||||
@ -951,7 +952,7 @@ js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
}
|
||||
|
||||
case JOF_ATOM: {
|
||||
Value v = StringValue(script->getAtom(GET_UINT32_INDEX(pc)));
|
||||
RootedValue v(cx, StringValue(script->getAtom(GET_UINT32_INDEX(pc))));
|
||||
JSAutoByteString bytes;
|
||||
if (!ToDisassemblySource(cx, v, &bytes))
|
||||
return 0;
|
||||
@ -960,7 +961,7 @@ js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
}
|
||||
|
||||
case JOF_DOUBLE: {
|
||||
Value v = script->getConst(GET_UINT32_INDEX(pc));
|
||||
RootedValue v(cx, script->getConst(GET_UINT32_INDEX(pc)));
|
||||
JSAutoByteString bytes;
|
||||
if (!ToDisassemblySource(cx, v, &bytes))
|
||||
return 0;
|
||||
@ -978,7 +979,8 @@ js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
JSObject *obj = script->getObject(GET_UINT32_INDEX(pc));
|
||||
{
|
||||
JSAutoByteString bytes;
|
||||
if (!ToDisassemblySource(cx, ObjectValue(*obj), &bytes))
|
||||
RootedValue v(cx, ObjectValue(*obj));
|
||||
if (!ToDisassemblySource(cx, v, &bytes))
|
||||
return 0;
|
||||
Sprint(sp, " %s", bytes.ptr());
|
||||
}
|
||||
@ -988,7 +990,8 @@ js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
case JOF_REGEXP: {
|
||||
JSObject *obj = script->getRegExp(GET_UINT32_INDEX(pc));
|
||||
JSAutoByteString bytes;
|
||||
if (!ToDisassemblySource(cx, ObjectValue(*obj), &bytes))
|
||||
RootedValue v(cx, ObjectValue(*obj));
|
||||
if (!ToDisassemblySource(cx, v, &bytes))
|
||||
return 0;
|
||||
Sprint(sp, " %s", bytes.ptr());
|
||||
break;
|
||||
@ -1026,7 +1029,8 @@ js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
Sprint(sp, " %u", GET_SLOTNO(pc));
|
||||
JSObject *obj = script->getObject(GET_UINT32_INDEX(pc + SLOTNO_LEN));
|
||||
JSAutoByteString bytes;
|
||||
if (!ToDisassemblySource(cx, ObjectValue(*obj), &bytes))
|
||||
RootedValue v(cx, ObjectValue(*obj));
|
||||
if (!ToDisassemblySource(cx, v, &bytes))
|
||||
return 0;
|
||||
Sprint(sp, " %s", bytes.ptr());
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user