Closed Bug 570986 Opened 12 years ago Closed 12 years ago

nsGlobalWindow::Dump should check all bytes, not chars, when replacing \r with \n

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: adw, Assigned: adw)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
nsGlobalWindow::Dump converts all \r to \n on Mac, but when it iterates over the cstring, the upper bound of iteration is the number of characters in the string when it should be the number of bytes.  As a result it can stop iteration too soon if the string contains multi-byte chars and therefore miss some \r, as running this snippet shows:

  dump("\u6587\r");

Via bug 570291 comment 3 and 4.
Attachment #450137 - Flags: review?(bzbarsky)
Comment on attachment 450137 [details] [diff] [review]
patch

r=bzbarsky
Attachment #450137 - Flags: review?(bzbarsky) → review+
http://hg.mozilla.org/mozilla-central/rev/9c0d92ff943f
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.