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
|
|
@ -74,6 +74,16 @@ describe("Document", [&]() {
|
|||
"(array (true) (false))");
|
||||
});
|
||||
|
||||
it("handles truncated UTF16 data", [&]() {
|
||||
const char content[1] = { '\0' };
|
||||
spy_input->content = string(content, sizeof(content));
|
||||
spy_input->encoding = TSInputEncodingUTF16;
|
||||
|
||||
ts_document_set_input(document, spy_input->input());
|
||||
ts_document_invalidate(document);
|
||||
ts_document_parse(document);
|
||||
});
|
||||
|
||||
it("allows columns to be measured in either bytes or characters", [&]() {
|
||||
const char16_t content[] = u"[true, false]";
|
||||
spy_input->content = string((const char *)content, sizeof(content));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue