Closed Bug 442086 Opened 16 years ago Closed 16 years ago

XPConnect creates doubles without checking for the INT_FITS_IN_JSVAL case

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jorendorff, Assigned: jorendorff)

References

Details

Attachments

(2 files)

See bug 435288.  The bug is in xpcconvert.cpp, in the definition of JAM_DOUBLE and the places where it's used.

http://mxr.mozilla.org/mozilla-central/source/js/src/xpconnect/src/xpcconvert.cpp#174

The actual symptom:  If a value produced this way is used in certain JS switch statements, it can incorrectly fail to match any cases.

(This code also fails to report out-of-memory errors.  Should I bother fixing that?)
Attached file test case
You can actually get to this bug via the DOM.
Attached patch v1Splinter Review
This fixes the bug ...and makes it return JS_FALSE on out of memory.

An xpconnect unit test is included.  Did I put that in the right place?

I took out a comment that said, "XXX will this break backwards compatability???"  The comment had been there since 2001, so I figure we're good.

The "Support for 64 bit conversions where 'long long' not supported" had to be touched.  As I don't even know what those platforms might be, the new code is untested.
Assignee: nobody → jorendorff
Status: NEW → ASSIGNED
Attachment #327247 - Flags: review?
Attachment #327247 - Flags: review? → review?(shaver)
Attachment #327247 - Flags: review?(shaver) → review?(jst)
I ran this through the try server and everything came up green.  (2008/07/16 22:28:02)
Comment on attachment 327247 [details] [diff] [review]
v1

Looks good, it'd be good if Brendan could have a look at this one too.
Attachment #327247 - Flags: superreview?(brendan)
Attachment #327247 - Flags: review?(jst)
Attachment #327247 - Flags: review+
Comment on attachment 327247 [details] [diff] [review]
v1

>+/*
>+* Support for 64 bit conversions where 'long long' not supported.
>+* (from John Fairhurst <mjf35@cam.ac.uk>)
>+*/

May as well fix comment style since it is moving enough not to show blame directly.

sr=me, although I think jst can r+sr with impunity ;-).

/be
Attachment #327247 - Flags: superreview?(brendan) → superreview+
http://hg.mozilla.org/mozilla-central/rev/c898e650581d
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: