Skip to content

Fix out of bounds access in unsafeCodePointAt0Fallback #112

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

Merged
merged 2 commits into from
Nov 11, 2018

Conversation

zyla
Copy link
Contributor

@zyla zyla commented Nov 6, 2018

The precondition for unsafeCodePointAt0 is that the string length in code units is at least 1. But the fallback version only worked for length > 2, because it always accessed index 1.

This was not caught by the test suite, because fallbacks are not used in node.js. I added a second test run to the test script that forces the use of fallbacks.

zyla added 2 commits November 6, 2018 12:30
`unsafeCodePointAt0Fallback` crashed when passed a string of length 1
due to always accessing index 1.
Copy link
Contributor

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Great catch, and thanks for the testing idea.

@garyb
Copy link
Member

garyb commented Nov 11, 2018

Thanks!

@garyb garyb merged commit 94c843b into purescript:master Nov 11, 2018
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.

3 participants