The default bug view has changed. See this FAQ.

nsPlainTextSerializer.cpp should not use AssignWithConversion

RESOLVED FIXED in mozilla10

Status

()

Core
Serializers
RESOLVED FIXED
13 years ago
3 years ago

People

(Reporter: Biesinger, Assigned: m_kato)

Tracking

(Blocks: 1 bug)

Trunk
mozilla10
x86
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

content/base/src/nsPlainTextSerializer.cpp should not use AssignWithConversion

once bug 252950 is fixed, m1b will be ascii, and this file can use AssignASCII.
Assignee: dom-to-text → nobody
QA Contact: dom-to-text
(Assignee)

Updated

6 years ago
Blocks: 113234
(Assignee)

Comment 1

6 years ago
Created attachment 570634 [details] [diff] [review]
fix
Assignee: nobody → m_kato
Attachment #570634 - Flags: review?(Olli.Pettay)
Comment on attachment 570634 [details] [diff] [review]
fix


>   else {
>-    textstr.AssignWithConversion(frag->Get1b()+aStartOffset, length);
>+    // AssignASCII is for 7-bit character only, so don't use it
>+    const char *data = frag->Get1b();
>+    CopyASCIItoUTF16(Substring(data + aStartOffset, data + endoffset), textstr);
>   }

Interesting. Would it be possible to get a test which would fail if AssignASCII was used?
(Assignee)

Comment 3

6 years ago
(In reply to Olli Pettay [:smaug] from comment #2)
> Comment on attachment 570634 [details] [diff] [review] [diff] [details] [review]
> fix
> 
> 
> >   else {
> >-    textstr.AssignWithConversion(frag->Get1b()+aStartOffset, length);
> >+    // AssignASCII is for 7-bit character only, so don't use it
> >+    const char *data = frag->Get1b();
> >+    CopyASCIItoUTF16(Substring(data + aStartOffset, data + endoffset), textstr);
> >   }
> 
> Interesting. Would it be possible to get a test which would fail if
> AssignASCII was used?

Several tests are failure if using AssignASCII.

https://tbpl.mozilla.org/php/getParsedLog.php?id=7117846&tree=Try
https://tbpl.mozilla.org/php/getParsedLog.php?id=7117826&tree=Try
https://tbpl.mozilla.org/php/getParsedLog.php?id=7117897&tree=Try

Although AssignASCII uses char_traits::copyASCII(), it works on 7-bit character only.  If using 8-bit character, it will be different result due to cast.

http://mxr.mozilla.org/mozilla-central/source/xpcom/string/public/nsCharTraits.h#222
Comment on attachment 570634 [details] [diff] [review]
fix

Ok, thanks.
Attachment #570634 - Flags: review?(Olli.Pettay) → review+
(Assignee)

Comment 5

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/89649127982e
Whiteboard: [inbound]
https://hg.mozilla.org/mozilla-central/rev/89649127982e
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.