tree-sitter.tree-sitter/lib
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
..
binding_rust perf(cli): minor allocation and write call reductions 2026-03-31 01:27:05 -04:00
binding_web build(deps): bump vite from 7.3.1 to 7.3.2 in /lib/binding_web 2026-04-07 10:10:18 +02:00
include/tree_sitter fix(lib): correct various typos 2026-03-28 05:23:10 -04:00
lldb_pretty_printers feat(lib): add lldb pretty-printers for some C lib types 2025-08-22 20:10:03 -04:00
src lexer: pass code-unit length to U16_NEXT in UTF-16 decoders 2026-04-26 03:38:47 -04:00
.ccls rust: Change QueryCursor::captures to expose the full match 2019-10-03 12:45:58 -07:00
Cargo.toml build(deps): bump wasmtime-c-api to v36.0.7 2026-04-10 00:41:06 +02:00
LICENSE chore: copy license to all packages 2025-09-11 03:12:35 -04:00
package.nix build(cmake)!: move CMakeLists.txt to the source root 2025-09-11 01:59:37 -04:00
README.md docs: update badges; fix markdown lint complains 2023-04-16 23:39:08 +03:00
tree-sitter.pc.in build(lib): build using cmake 2024-09-07 18:38:05 -04:00

Subdirectories

  • src - C source code for the Tree-sitter library
  • include - C headers for the Tree-sitter library
  • binding_rust - Rust bindings to the Tree-sitter library
  • binding_web - JavaScript bindings to the Tree-sitter library, using WebAssembly