Closed Bug 351871 Opened 18 years ago Closed 6 years ago

NativeData2JS does not handle unsigned 64 bit correctly

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: jhpedemonte, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

Due to the definition of JAM_DOUBLE_U64  (http://lxr.mozilla.org/mozilla/source/js/src/xpconnect/src/xpcconvert.cpp#176) in xpcconvert.cpp, unsigned 64 bit values are treated as signed values, which leads to incorrect values for large unsigned 64 bit numbers.  It seems like the correct thing to do is to use LL_L2D, as is done in the #else block for the code.
Attached patch patch (obsolete) — Splinter Review
Something like this.  The comment for JAM_DOUBLE_U64 says that "Win32 can't handle uint64 to double conversion", but this worked just fine for me on WinXP.  Maybe older Win32 systems?
Attachment #237375 - Flags: review?(shaver)
Comment on attachment 237375 [details] [diff] [review]
patch

Nope, this patch is wrong; my testcase was incorrect. Unsigned still treated as signed.
Attachment #237375 - Attachment is obsolete: true
Attachment #237375 - Flags: review?(shaver)
Attached patch patch v1.1Splinter Review
This is better.  However, I haven't tested this on a Win32 machine.
Blocks: 350886
Assignee: dbradley → nobody
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: