Commit 70519ed
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 7ee1e61 commit 70519ed
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19816 | 19816 | | |
19817 | 19817 | | |
19818 | 19818 | | |
| 19819 | + | |
| 19820 | + | |
| 19821 | + | |
| 19822 | + | |
| 19823 | + | |
| 19824 | + | |
| 19825 | + | |
| 19826 | + | |
| 19827 | + | |
| 19828 | + | |
| 19829 | + | |
| 19830 | + | |
19819 | 19831 | | |
19820 | 19832 | | |
19821 | 19833 | | |
| |||
0 commit comments