Closed
Bug 565615
Opened 15 years ago
Closed 14 years ago
TraceRecorder::stringify is odd
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: timeless, Assigned: timeless)
References
(Blocks 1 open bug)
Details
(Keywords: coverity, Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
timeless
:
review+
|
Details | Diff | Splinter Review |
208 struct JSAtomState {
229 * Literal value and type names.
230 * NB: booleanAtoms must come right before typeAtoms!
231 */
232 JSAtom *booleanAtoms[2];
233 JSAtom *typeAtoms[JSTYPE_LIMIT];
376 #define INS_ATOM(atom) INS_CONSTSTR(ATOM_TO_STRING(atom))
8298 TraceRecorder::stringify(jsval& v)
8308 } else if (JSVAL_IS_VOID(v)) {
8309 /* N.B. void is JSVAL_SPECIAL. */
8310 return INS_ATOM(cx->runtime->atomState.booleanAtoms[2])
Is there a reason we're using booleanAtoms[2] instead of typeAtoms[0] ?
Comment 2•15 years ago
|
||
The original reason for the convolution (before the bug 552586) was to allow the original implementation of js_BooleanOrUndefinedToString:
JSString* FASTCALL
js_BooleanOrUndefinedToString(JSContext *cx, int32 unboxed)
{
JS_ASSERT(uint32(unboxed) <= 2);
return ATOM_TO_STRING(cx->runtime->atomState.booleanAtoms[unboxed]);
}
Of course, void was specialized when TT_SPECIAL was split into TT_BOOLEAN and TT_VOID and I failed to notice the hack and instead transplanted it.
This doesn't seem to be security sensitive unless you are pointing out that the compiler is technically allowed to insert arbitrary padding. I seem to recall other code depending on the exact layout of atoms.
No longer blocks: 552586
Comment 3•15 years ago
|
||
This bug is not a bug. We have static assertions ensuring no padding.
But we should use typeAtoms[0], yeah.
/be
Group: core-security
Updated•15 years ago
|
Attachment #445087 -
Flags: review?(jorendorff) → review+
Keywords: checkin-needed
Attachment #445087 -
Attachment is obsolete: true
Attachment #499723 -
Flags: review+
Comment 5•14 years ago
|
||
Keywords: checkin-needed
Whiteboard: fixed-in-tracemonkey
Comment 6•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Blocks: coverity-analysis
You need to log in
before you can comment on or make changes to this bug.
Description
•