Commit 21bed02
authored
fix(parser): enforce subst depth limit in unquoted cmdsub (#1018)
## Summary
- Enforce `max_subst_depth` in unquoted `$()` context in `read_word`,
matching the limit already enforced in double-quoted strings
- Defense-in-depth: prevents deeply nested `$()` from bypassing depth
limit
Closes #996
## Test plan
- [x] New spec tests: `cmdsub_depth_unquoted.test.sh` with 3 cases
- [x] Existing `parse_incomplete_command_sub` test still passes
- [x] `cargo test --all-features` passes
- [x] `cargo clippy -- -D warnings` clean1 parent 747cda7 commit 21bed02
2 files changed
Lines changed: 50 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
685 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
686 | 688 | | |
| 689 | + | |
687 | 690 | | |
688 | 691 | | |
689 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
690 | 713 | | |
691 | 714 | | |
692 | 715 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments