Merge pull request #92 from tree-sitter/utf16-oob
Add test for UTF16 out-of-bound read
This commit is contained in:
commit
10d28d4b56
4 changed files with 27 additions and 7 deletions
|
|
@ -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];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue