← Commit list

e9c21c5c3

Denys Vlasenko
Denys Vlasenko
2025-07-08
SUCCESS Duration: 157s

Subject

hush: fix SEGV on "echo << >" and such

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/hush.c+5 -0
@@ -4625,6 +4625,11 @@ static int fetch_heredocs(o_string *as_string, struct pipe *pi, int heredoc_cnt,
redir->rd_type = REDIRECT_HEREDOC2;
/* redir->rd_dup is (ab)used to indicate <<- */
+ if (!redir->rd_filename) {
+ /* examples: "echo <<", "echo <<<", "echo <<>" */
+ syntax_error("missing here document terminator");
+ return -1;
+ }
p = fetch_till_str(as_string, input,
redir->rd_filename, redir->rd_dup);
if (!p) {
shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF1.right+1 -0
@@ -0,0 +1 @@
+hush: syntax error: missing here document terminator
shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF1.tests+2 -0
@@ -0,0 +1,2 @@
+echo <<
+echo Done:
shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF2.right+1 -0
@@ -0,0 +1 @@
+hush: syntax error: missing here document terminator
shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF2.tests+2 -0
@@ -0,0 +1,2 @@
+echo << >
+echo Done: