Closed Bug 513701 Opened 15 years ago Closed 15 years ago

JS_ISSPACE has wrong space character check

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: sayrer, Assigned: gal)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

+++ 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>
Summary: JS_ISSPACE should check for space character at least → JS_ISSPACE has wrong space character check
Attached patch patchSplinter Review
Assignee: general → gal
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+
Whiteboard: fixed-in-tracemonkey
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: