On big-endian processor, nsUTF16ToUnicodeBase::UTF16ConvertToUnicode is mis-converting UTF16 data

RESOLVED FIXED in mozilla26

Status

()

Core
Internationalization
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: t_mrc-ct, Assigned: t_mrc-ct)

Tracking

Trunk
mozilla26
PowerPC
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Created attachment 792221 [details]
last few lines of test_singlebytes.js log (because it is tooooo long)

User Agent: Mozilla/5.0 (Macintosh; PPC Mac OS X 10.5; rv:17.0) Gecko/20130805 Firefox/17.0 TenFourFox/G5 (Nightly/Aurora)
Build ID: 20130805171245

Steps to reproduce:

On TenFourFox 22 with --enable-tests build config.
Run xpcshell-tests 


Actual results:

dom/encoding/test/unit/test_singlebytes.js unit test failied.


Expected results:

test passed without failure.
(Assignee)

Comment 1

5 years ago
Created attachment 792229 [details] [diff] [review]
patch for intl/uconv/ucvlatin/nsUTF16ToUnicode.cpp

Before bitwise-or, (*src++) is implicitly cast to int16_t.
If src has negative value, upper byte of casted src is 0xff.
It mask upper byte of u.

this patch prevent it.

Comment 2

5 years ago
Thanks for the patch! You should ask someone to review it though, otherwise it's likely to get ignored.

I suggest that you request a review from :smontagu, as he's previously worked on this code.

The patch review and submission process is explained in more detail here:
https://developer.mozilla.org/en-US/docs/Developer_Guide/How_to_Submit_a_Patch
(Assignee)

Comment 3

5 years ago
Comment on attachment 792229 [details] [diff] [review]
patch for intl/uconv/ucvlatin/nsUTF16ToUnicode.cpp

Thank you for your information. 

I request review to :smontagu.
Attachment #792229 - Flags: review?(smontagu)
Comment on attachment 792229 [details] [diff] [review]
patch for intl/uconv/ucvlatin/nsUTF16ToUnicode.cpp

Review of attachment 792229 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch, thanks!
Attachment #792229 - Flags: review?(smontagu) → review+

Updated

5 years ago
Assignee: nobody → t_mrc-ct
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
See
https://developer.mozilla.org/en-US/docs/Creating_a_patch_that_can_be_checked_in
for how to upload a new patch file and add the checkin-needed keyword to get this checked in.
(Assignee)

Comment 6

5 years ago
Created attachment 793478 [details] [diff] [review]
Bug 906698 - nsUTF16ToUnicode is mis-converting on big-endian processor

fix patch format.
Attachment #792229 - Attachment is obsolete: true
Attachment #793478 - Flags: review?(smontagu)
(Assignee)

Updated

5 years ago
Keywords: checkin-needed
Comment on attachment 793478 [details] [diff] [review]
Bug 906698 - nsUTF16ToUnicode is mis-converting on big-endian processor

You don't need to re-request review when all that's changing is the patch format.
Attachment #793478 - Flags: review?(smontagu)
https://hg.mozilla.org/mozilla-central/rev/2654e3d27d41
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.