purescript / purescript-strings

String utility functions, Char type, regular expressions.
BSD 3-Clause "New" or "Revised" License
54 stars 71 forks source link

Fix out of bounds access in `unsafeCodePointAt0Fallback` #112

Closed zyla closed 5 years ago

zyla commented 6 years ago

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.

garyb commented 5 years ago

Thanks!