Closed
Bug 513701
Opened 15 years ago
Closed 15 years ago
JS_ISSPACE has wrong space character check
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.2 | --- | beta1-fixed |
People
(Reporter: sayrer, Assigned: gal)
References
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
682 bytes,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #513379 +++
js_SkipWhiteSpace should check for characters matching the StrWhiteSpaceChar production in the ES5 spec. These are both whitespace and line terminators:
whitespace:
\u0009 Tab <TAB>
\u000B Vertical Tab <VT>
\u000C Form Feed <FF>
\u0020 Space <SP>
\u00A0 No-break space <NBSP>
\uFEFF Byte Order Mark <BOM>
Any other Unicode ―space separator <USP>
line terminators:
\u000A Line Feed <LF>
\u000D Carriage Return <CR>
\u2028 Line separator <LS>
\u2029 Paragraph separator <PS>
Reporter | ||
Updated•15 years ago
|
Summary: JS_ISSPACE should check for space character at least → JS_ISSPACE has wrong space character check
Assignee | ||
Comment 1•15 years ago
|
||
Assignee: general → gal
Comment 2•15 years ago
|
||
Comment on attachment 397992 [details] [diff] [review]
patch
>diff --git a/js/src/jsstr.h b/js/src/jsstr.h
>--- a/js/src/jsstr.h
>+++ b/js/src/jsstr.h
>@@ -520,17 +520,17 @@ extern const bool js_alnum[];
> #define JS_ISDIGIT(c) (JS_CTYPE(c) == JSCT_DECIMAL_DIGIT_NUMBER)
>
> static inline bool
> JS_ISSPACE(jschar c)
> {
> unsigned w = c;
>
> if (w < 256)
>- return w <= ' ' && (w == ' ' || (9 <= w && w <= 0xD));
>+ return (w <= ' ' && (w == ' ' || (9 <= w && w <= 0xD))) || (w == 0xA0);
Inconsistency! You didn't over-parenthesize w == ' ' (did WebKit? :-P so don't over-paren w == 0xA0:
return (w <= ' ' && (w == ' ' || (9 <= w && w <= 0xD))) || w == 0xA0;
If there is a better machine code sequence, I hope GCC turns on the super-optimizer, runs it on this, and does even better some day.
/be
Attachment #397992 -
Flags: review+
Assignee | ||
Comment 3•15 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 4•15 years ago
|
||
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 5•15 years ago
|
||
status1.9.2:
--- → beta1-fixed
Flags: wanted1.9.2+
You need to log in
before you can comment on or make changes to this bug.
Description
•