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

Fix OOM when parsing bare hexadecimal literal. #229

Merged
merged 2 commits into from Apr 4, 2020
Merged

Fix OOM when parsing bare hexadecimal literal. #229

merged 2 commits into from Apr 4, 2020

Conversation

mkantor
Copy link
Contributor

@mkantor mkantor commented Apr 4, 2020

When parsing a bare hexadecimal number like JSON5.parse('0x1'), the parser was looping forever here because it was reading to the end and util.isHexDigit(undefined) === true.

I updated all of the util.is* functions to return false for undefined and added some regression tests.

Fixes #228.

@mkantor mkantor changed the title Fix #228. Fix OOM when parsing bare hexadecimal literal. Apr 4, 2020
@jordanbtucker jordanbtucker self-assigned this Apr 4, 2020
@jordanbtucker jordanbtucker merged commit f1d3c8a into json5:master Apr 4, 2020
@jordanbtucker
Copy link
Member

Thanks for finding and fixing this bug. The fix should be live in v2.1.3 now.

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.

Attempting to parse hexadecimal integer literal results in OOM
2 participants