Commit 9bd2370
Fix stack-use-after-return with unterminated heredocs
The heredoc handler in parse_expression_prefix stores the address of
its stack-local common_whitespace into the heredoc lex mode. When the
heredoc terminator is missing, expect1_heredoc_term reports an error
without popping the lex mode, so the stored pointer outlives the stack
frame and subsequent lexing reads dead stack memory.
Clear the pointer before leaving the handler; the lexer already guards
against NULL.
Co-authored-by: Claude <noreply@anthropic.com>1 parent 880833d commit 9bd2370
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19712 | 19712 | | |
19713 | 19713 | | |
19714 | 19714 | | |
| 19715 | + | |
| 19716 | + | |
| 19717 | + | |
| 19718 | + | |
| 19719 | + | |
| 19720 | + | |
| 19721 | + | |
| 19722 | + | |
| 19723 | + | |
| 19724 | + | |
| 19725 | + | |
| 19726 | + | |
19715 | 19727 | | |
19716 | 19728 | | |
19717 | 19729 | | |
| |||
0 commit comments