Closed Bug 31003 Opened 25 years ago Closed 24 years ago

Error in function JS_XDRValue

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: Holger.Janz, Assigned: rogerl)

References

Details

From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT) BuildID: JS 1.5B1 In JS_XDRValue the case JSVAL_VOID of switch (type) can never be reached. You can not compare JSVAL_TAG of vp with JSVAL_VOID. You have to check against vp. Reproducible: Didn't try Steps to Reproduce: read source jsxdrapi of js15b1 line 543fff Expected Results: remove case JSVAL and use if( JSVAL_IS_VOID(*vp)) for this case
Seems like a sensible suggestion, but I know nothing about this stuff. Shaver - can you comment? I'll handle fixing it if you think it makes sense.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
I guess it makes sense, given that it's already in there. I can't think of a case where you would actually be trying to XDR a JSVAL_VOID, though, and am a little worried that people are using XDR in ways that exceed its current implementation. Holger?
*** Bug 32493 has been marked as a duplicate of this bug. ***
here's the patch, I'll get it checked in when I next get a clear shot at the tree --- jsxdrapi.c 2000/02/04 02:01:49 1.11 +++ jsxdrapi.c 2000/04/26 00:47:22 @@ -451,7 +451,12 @@ JS_PUBLIC_API(JSBool) JS_XDRValue(JSXDRState *xdr, jsval *vp) { - uint32 type = JSVAL_TAG(*vp); + uint32 type; + + if (JSVAL_IS_VOID(*vp)) + return JS_XDRUint32(xdr, (uint32 *)vp); + + type = JSVAL_TAG(*vp); if (!JS_XDRUint32(xdr, &type)) return JS_FALSE; @@ -494,10 +499,6 @@ *vp = BOOLEAN_TO_JSVAL((JSBool)b); break; } - case JSVAL_VOID: - if (!JS_XDRUint32(xdr, (uint32 *)vp)) - return JS_FALSE; - break; default: { char numBuf[12]; if (type & JSVAL_INT) {
I still don't understand how you could ever have this case in real operation, and I'd like to understand the error better before we make this change.
[SPAM] Bug triage for nsbeta3
Target Milestone: --- → Future
Updating QA contact -
QA Contact: rginda → pschwartau
Fixed by my latest (step 1) patch in bug 68045. /be
Depends on: 68045
Fix is in. /be
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Marking Verified -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.