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

Prevent infinite loop from empty match (fix #77) #156

Merged
merged 2 commits into from Feb 2, 2015

Conversation

Projects
None yet
2 participants
@jonathanhefner
Contributor

jonathanhefner commented Feb 2, 2015

This fix for #77 prevents empty regex matches (via e.g. /a?/, /a*/) from causing an infinite loop. It does so by checking that the regex's lastIndex property increases on each call to RegExp.exec.

Incidentally, RegExp.exec sucks and mutation is evil, so I included another fix to prevent said mutation from leaking into Elm.

Test coverage is included.

evancz pushed a commit that referenced this pull request Feb 2, 2015

Merge pull request #156 from jonathanhefner/issue-77-fix-regex-find
Prevent infinite loop from empty match (fix #77)

@evancz evancz merged commit fe85d07 into elm:master Feb 2, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@nathan nathan referenced this pull request Mar 6, 2015

Closed

Regexes are stateful #188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment