Skip to content

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