tree-sitter.tree-sitter/test/fixtures
Daniel Jalkut 0f6780b9a3 lexer: pass code-unit length to U16_NEXT in UTF-16 decoders
`ts_decode_utf16_le` and `ts_decode_utf16_be` passed a byte length to
`U16_NEXT_LE` and `U16_NEXT_BE`, but those macros count `uint16_t` code
units. If a lead surrogate was the last code unit in a chunk, the decoder
could peek past the chunk and combine it with adjacent memory.

This commit passes the code-unit length to the UTF-16 macros, and fails
with `TS_DECODE_ERROR` when a chunk is too short to contain even one full
code unit. This lets the lexer retry with a fresh chunk or advance through
the invalid byte as it already does.

Co-authored-by: Will Lillis <will.lillis24@gmail.com>
Co-authored-by: Amaan Qureshi <git@amaanq.com>
2026-04-26 03:38:47 -04:00
..
error_corpus chore: update javascript error trees 2024-02-02 03:06:38 -05:00
grammars Rename spec -> test 2017-03-09 20:40:01 -08:00
template_corpus Add tests that randomly edit files with disjoint included ranges 2022-11-14 16:04:37 -08:00
test_grammars lexer: pass code-unit length to U16_NEXT in UTF-16 decoders 2026-04-26 03:38:47 -04:00
fixtures.json test: bump c test fixture to v0.24.2 2026-04-23 03:31:00 -04:00