Skip to content

Commit 86c1972

Browse files
committed
docs(third-party): record the ts_runtime stack-merge bound as a local modification
The DeusData#913 GLR recursion cap patches vendored ts_runtime/src/stack.c; document it in THIRD_PARTY.md so the vendored modification is on record and re-applied on the next ts_runtime re-vendor (Stage 4: 0.26.x). The patch is marked inline; this adds the provenance-level note the policy requires for any change to vendored code. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent da046da commit 86c1972

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎THIRD_PARTY.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ The tree-sitter C runtime is vendored in `internal/cbm/vendored/ts_runtime/`.
1313
- **License:** MIT
1414
- **Copyright:** (c) 2018–2024 Max Brunsfeld
1515

16+
**Local modification** (`internal/cbm/vendored/ts_runtime/src/stack.c`, #913): a
17+
single CBM patch bounds the recursive ambiguity-merge in `stack_node_add_link`
18+
at `CBM_TS_STACK_MERGE_MAX_DEPTH` (512). Deeply nested grammar-ambiguous input
19+
(e.g. Perl `f(f(f(...)))`) otherwise recurses once per level on the native C
20+
stack and overflows it during parsing (SIGSEGV on the ~1 MB Windows thread
21+
stack, and even the 8 MB POSIX stack at extreme depth) before any extractor
22+
runs. Past the cap the ambiguity is left on the GLR stack instead of merged —
23+
still a valid parse, never a wrong one — mirroring the existing
24+
`MAX_LINK_COUNT` bail-out. The change is clearly marked `// CBM patch:` inline.
25+
**On re-vendor (e.g. ts_runtime → 0.26.x): re-apply this bound.**
26+
1627
The shared scanner helpers in `internal/cbm/vendored/common/` (`scanner.h`,
1728
`tag.h`) originate from
1829
[tree-sitter-html](https://github.com/tree-sitter/tree-sitter-html) (MIT,

0 commit comments

Comments
 (0)