Closed Bug 316573 Opened 19 years ago Closed 19 years ago

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

Categories

(Core :: XPCOM, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Keywords: crash)

Attachments

(1 file)

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).
Attached patch Like soSplinter Review
Attachment #203149 - Flags: superreview?(jst)
Attachment #203149 - Flags: review?(smontagu)
Priority: -- → P1
Target Milestone: --- → mozilla1.9alpha
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
Closed: 19 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: