From 86c19720a22d9b86acb5e007dbebeba833f2f5ac Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Thu, 16 Jul 2026 00:18:41 +0200 Subject: [PATCH] docs(third-party): record the ts_runtime stack-merge bound as a local modification The #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 --- THIRD_PARTY.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md index 40f26f732..4400a1449 100644 --- a/THIRD_PARTY.md +++ b/THIRD_PARTY.md @@ -13,6 +13,17 @@ The tree-sitter C runtime is vendored in `internal/cbm/vendored/ts_runtime/`. - **License:** MIT - **Copyright:** (c) 2018–2024 Max Brunsfeld +**Local modification** (`internal/cbm/vendored/ts_runtime/src/stack.c`, #913): a +single CBM patch bounds the recursive ambiguity-merge in `stack_node_add_link` +at `CBM_TS_STACK_MERGE_MAX_DEPTH` (512). Deeply nested grammar-ambiguous input +(e.g. Perl `f(f(f(...)))`) otherwise recurses once per level on the native C +stack and overflows it during parsing (SIGSEGV on the ~1 MB Windows thread +stack, and even the 8 MB POSIX stack at extreme depth) before any extractor +runs. Past the cap the ambiguity is left on the GLR stack instead of merged — +still a valid parse, never a wrong one — mirroring the existing +`MAX_LINK_COUNT` bail-out. The change is clearly marked `// CBM patch:` inline. +**On re-vendor (e.g. ts_runtime → 0.26.x): re-apply this bound.** + The shared scanner helpers in `internal/cbm/vendored/common/` (`scanner.h`, `tag.h`) originate from [tree-sitter-html](https://github.com/tree-sitter/tree-sitter-html) (MIT,