[FIX]HashCodeAsUTF8 doesn't work right for non-BMP chars

RESOLVED FIXED in mozilla1.9alpha1

Status

()

Core
XPCOM
P1
critical
RESOLVED FIXED
12 years ago
12 years ago

People

(Reporter: bz, Assigned: bz)

Tracking

({crash})

Trunk
mozilla1.9alpha1
x86
Linux
crash
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

We crash on shutdown if we atomize a string containing non-BMP chars, because HashCodeAsUTF8 does:

  347                 U = PRUint32( (W1&0x03FF)<<10 | (W&0x3FFF) );

which is wrong -- it needs to add 0x10000.  This has apparently been wrong as long as the code has been in our tree...

While I was here I updated the code to the more recent UTF8 RFC (which only allows sequences of up to 4 bytes).
Created attachment 203149 [details] [diff] [review]
Like so
Attachment #203149 - Flags: superreview?(jst)
Attachment #203149 - Flags: review?(smontagu)
Priority: -- → P1
Target Milestone: --- → mozilla1.9alpha

Updated

12 years ago
Attachment #203149 - Flags: review?(smontagu) → review+
Comment on attachment 203149 [details] [diff] [review]
Like so

sr=jst
Attachment #203149 - Flags: superreview?(jst) → superreview+
Fixed.
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.