Closed
Bug 456502
Opened 17 years ago
Closed 15 years ago
nsFind::Find() calls StripChars() on a non-ASCII char
Categories
(Core Graveyard :: Embedding: APIs, defect)
Core Graveyard
Embedding: APIs
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla2.0b1
People
(Reporter: sgautherie, Assigned: wesongathedeveloper)
References
()
Details
(Whiteboard: [good first bug])
Attachments
(1 file)
|
1.04 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
Bug 450048 comment 4
{
From Boris Zbarsky (todo: 200+ items) 2008-08-20 14:40:11 PDT
The code that calls StripChars on a non-ASCII char is wrong
}
I'm not sure what the issue is with non-ASCII chars,
nor how to fix it.
***
http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsStringAPI.h#175
http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsStringAPI.cpp#142
There might (not) be a few other cases !?
http://mxr.mozilla.org/mozilla-central/search?string=StripChars&case=on
Comment 1•17 years ago
|
||
The call will remove the wrong char. Instead of removing the char that you want, it'll remove that modulo 255.
The right way to fix it is to use an equivalent PRUnichar api, or to hand-write the StripChars code using PRUnichars.
Whiteboard: [good first bug]
| Reporter | ||
Comment 2•17 years ago
|
||
(In reply to comment #1)
> it'll remove that modulo 255.
The point I don't get is ASCII 7 bit vs char 8 bit:
|#define CH_SHY ((PRUnichar) 0xAD)|, especially as a |char|, is < 255, isn't it ?
> The right way to fix it is to use an equivalent PRUnichar api
Is there one ?
Should one be added to the String API ?
Comment 3•17 years ago
|
||
Ah, if CH_SHY is < 255, then this code is probably OK, though then it needs a big comment (and better yet a PR_STATIC_ASSERT) about that.
| Reporter | ||
Updated•17 years ago
|
Severity: normal → trivial
| Assignee | ||
Comment 4•15 years ago
|
||
Seems to me the <= operator is more appropriate.
Assignee: nobody → wesongathedeveloper
Status: NEW → ASSIGNED
Attachment #453871 -
Flags: review?(benjamin)
Updated•15 years ago
|
Attachment #453871 -
Flags: review?(benjamin) → review+
| Assignee | ||
Updated•15 years ago
|
Keywords: checkin-needed
Comment 5•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a6
Updated•6 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•