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.
| 5652 | // Realistic files never approach this; it only bounds a pathological/adversarial |
| 5653 | // file so extraction degrades to a warned skip rather than unbounded memory. |
| 5654 | static int wd_stack_max(void) { |
| 5655 | const char *e = getenv("CBM_WALK_DEFS_MAX"); |
| 5656 | if (e) { |
| 5657 | int v = atoi(e); |
| 5658 | if (v > 0) { |
| 5659 | return v; |
| 5660 | } |
| 5661 | } |
| 5662 | return 8 * 1024 * 1024; // 8M frames (~320 MB) default |
| 5663 | } |
| 5664 | |
| 5665 | static void wd_push(wd_stack_t *s, TSNode node, const char *enclosing_qn) { |
| 5666 | if (s->top >= s->cap) { |