Closed
Bug 191633
Opened 22 years ago
Closed 22 years ago
Rhino tokenizer should not use recursion
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
1.5R5
People
(Reporter: user, Assigned: norrisboyd)
Details
Attachments
(2 files)
411 bytes,
application/x-javascript
|
Details | |
41.27 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
Currently Rhino tokenizer calls itself recursively to process single line
comments which can lead to too deep recursion when processing many lines of //
comments.
Reproducible: Always
Steps to Reproduce:
1.Run Rhino shell against the following attached JavaScript file
Actual Results:
Exception in thread "main" java.lang.StackOverflowError
at org.mozilla.javascript.TokenStream.getToken(TokenStream.java:753)
at org.mozilla.javascript.TokenStream.getToken(TokenStream.java:1197)
Expected Results:
Single true should be printed
Reporter | ||
Comment 1•22 years ago
|
||
Reporter | ||
Comment 2•22 years ago
|
||
The patch also removes unused TokenStream.isJSIdentifier() and adds few
optimizations not to call java.lang.Character methods for ASCII characters.
In addition patch makes sure that different occurrences of the same string
returned as the same String instance which allows to speedup the interpreter
mode as different functions from a single script use the same string instances
for equals strings which reduces the need to call String.equals in various
runtime hash tables.
Reporter | ||
Comment 3•22 years ago
|
||
As this bug is not a regression since 1.5R3, its fixing should wait 1.5R4 release.
Comment 4•22 years ago
|
||
Testcase added to JS testsuite:
mozilla/js/tests/js1_5/Regress/regress-191633.js
This passes in SpiderMonkey, but fails in Rhino as Igor indicated.
Since the failure output is so enormous, I have temporarily added
the test to the rhino-n.tests skip list:
/cvsroot/mozilla/js/tests/rhino-n.tests,v <-- rhino-n.tests
new revision: 1.52; previous revision: 1.51
We can remove it from the skip list once this fix is checked in -
Reporter | ||
Comment 5•22 years ago
|
||
I commited the fix.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 6•22 years ago
|
||
Verified FIXED.
The above testcase now passes in the Rhino shell. I tested
optimization levels -1, 0, 1, and 9.
I will now remove the testcase from the rhino-n.tests skip list -
Status: RESOLVED → VERIFIED
Comment 7•22 years ago
|
||
rhino-n.tests has now been updated:
Checking in rhino-n.tests;
/cvsroot/mozilla/js/tests/rhino-n.tests,v <-- rhino-n.tests
new revision: 1.54; previous revision: 1.53
done
You need to log in
before you can comment on or make changes to this bug.
Description
•