Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test and fix for crash parsing regexp /0{0/ #102

Closed
wants to merge 8 commits into from

Conversation

alagopus
Copy link
Contributor

This admittedly strange regexp is a minimized version of a test case from the coffee-script project. Judging from a comment in NativeRegExp.java, incomplete quantifiers are supposed to be ignored. Instead, an java.lang.ArrayIndexOutOfBoundsException is thrown, causing the REPL to terminate:

$ java -jar build/rhino1_7R5pre/js.jar
Rhino 1.7 release 5 PRERELEASE 2013 01 17
js> /0{0/
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
    at org.mozilla.javascript.regexp.NativeRegExp.parseTerm(NativeRegExp.java:1124)
[ . . . more stack trace elided]

The change set in this pull request includes a unit test and fix for the open coded parsing of {} quantifiers.

@alagopus
Copy link
Contributor Author

Please feel free to ignore any commit other than e1f3b3f on master.
If there is interest for the fix from 270c4e5 I can separate into another PR.

@alagopus
Copy link
Contributor Author

@gbrail
Copy link
Collaborator

gbrail commented Sep 28, 2017

This very old PR is actually quite reasonable, so I created #342 to cherry-pick it.

@gbrail gbrail closed this Oct 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants