Generous safety ceiling (frames), env-overridable via CBM_WALK_DEFS_MAX. Realistic files never approach this; it only bounds a pathological/adversarial file so extraction degrades to a warned skip rather than unbounded memory.
| 6643 | // Realistic files never approach this; it only bounds a pathological/adversarial |
| 6644 | // file so extraction degrades to a warned skip rather than unbounded memory. |
| 6645 | static int wd_stack_max(void) { |
| 6646 | const char *e = getenv("CBM_WALK_DEFS_MAX"); |
| 6647 | if (e) { |
| 6648 | int v = atoi(e); |
| 6649 | if (v > 0) { |
| 6650 | return v; |
| 6651 | } |
| 6652 | } |
| 6653 | return 8 * 1024 * 1024; // 8M frames (~320 MB) default |
| 6654 | } |
| 6655 | |
| 6656 | static void wd_push(wd_stack_t *s, TSNode node, const char *enclosing_qn) { |
| 6657 | if (s->top >= s->cap) { |