Closed
Bug 191668
Opened 22 years ago
Closed 22 years ago
Tokenizer can fail on <!-
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
1.5R4
People
(Reporter: user, Assigned: norrisboyd)
Details
Attachments
(2 files, 1 obsolete file)
166 bytes,
application/x-javascript
|
Details | |
51.94 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003
Build Identifier: Rhino CVS from 2003-02-02
Rhino tokenizer violates single character lookahead restriction of
omj.LineBuffer when implementing recognition of HTML comments <!-- . In
particular, LineBuffer assumes that calls to LineBuffer.match will not unread
after successful match, but code to recognize <!-- does exactly that as <! and
<!- are valid sequence of JavaScript operators.
The following attached test case calls eval on "if (0<!-0) ++j;" prefixed by
increasing sequence of spaces to make sure that at some point <!- occurs on
internal buffer boundary when LineBuffer.unread can not work.
Reproducible: Always
Steps to Reproduce:
Run the test by Rhino shell
Actual Results:
Exception in thread "main" java.lang.RuntimeException: FAILED ASSERTION
at org.mozilla.javascript.Context.codeBug(Context.java:2150)
at org.mozilla.javascript.LineBuffer.unread(LineBuffer.java:116)
at org.mozilla.javascript.TokenStream.getToken(TokenStream.java:1131)
Expected Results:
The test should print OK
Reporter | ||
Comment 1•22 years ago
|
||
Reporter | ||
Comment 2•22 years ago
|
||
As the bug presents in 1.5R3, its fix should wait until 1.5R4 is released.
Reporter | ||
Comment 3•22 years ago
|
||
Comment 4•22 years ago
|
||
Testcase added to JS testsuite:
mozilla/js/tests/js1_5/Regress/regress-191668.js
Currently passing in SpiderMonkey, but failing in Rhino as
Igor described above -
Reporter | ||
Comment 5•22 years ago
|
||
This is a patch update that integrates LineBuffer into TokenStream and teaches
it to read tokens from String, not only java.io.Reader to avoid constructing
StringReader/TokenStream buffer when evaluating scripts from strings.
Attachment #113398 -
Attachment is obsolete: true
Reporter | ||
Comment 6•22 years ago
|
||
I commited the patch
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 7•22 years ago
|
||
Verified FIXED.
The above testcase now passes in the Rhino shell. I tested
optimization levels -1, 0, 1, and 9.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•