Merge pull request #92 from tree-sitter/utf16-oob

Add test for UTF16 out-of-bound read
This commit is contained in:
Max Brunsfeld 2017-07-18 17:24:31 -07:00 committed by GitHub
commit 10d28d4b56
4 changed files with 27 additions and 7 deletions

View file

@ -1,6 +1,11 @@
#include "runtime/utf16.h"
int utf16_iterate(const uint8_t *string, size_t length, int32_t *code_point) {
if (length < 2) {
*code_point = -1;
return 0;
}
uint16_t *units = (uint16_t *)string;
uint16_t unit = units[0];