Update of bug #68783 (group groff):

                 Summary: [troff] empty string interpolation given as argument
to `so` request causes SEGV since 1.24.0 => [PATCH] [troff] empty string
interpolation given as argument to `so` request causes SEGV since 1.24.0

    _______________________________________________________

Follow-up Comment #1:


commit e4d9fe92964dbcb9e61b350bd0b8ef6892e244f4
Author: G. Branden Robinson <[email protected]>
Date:   Fri Oct 16 12:37:49 2026 -0500

    XXX [troff]: Fix Savannah #68783.
    
    Before (since groff 1.24.0):
    $ echo '.so \*a' | groff
    groff: error: troff: Segmentation fault (core dumped)
    $ echo '.soquiet \*a' | groff
    groff: error: troff: Segmentation fault (core dumped)
    
    Now:
    $ echo '.so \*a' | ./build/test-groff -ww
    troff:<standard input>:1: warning: name 'a' not defined [-w mac]
    troff:<standard input>:1: warning: file sourcing request expects argument
[-w missing]
    $ echo '.soquiet \*a' | ./build/test-groff -ww
    troff:<standard input>:1: warning: name 'a' not defined [-w mac]
    troff:<standard input>:1: warning: quiet file sourcing request expects
argument [-w missing]

diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 1ffef9a92..af673591e 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7626,7 +7626,17 @@ static void while_continue_request() // .continue
 
 static void do_source(bool quietly)
 {
+  const char *rd = 0 /* nullptr */; // request description
+  if (quietly)
+    rd = "quiet file sourcing request";
+  else
+    rd = "file sourcing request";
   char *filename = read_rest_of_line_as_argument();
+  if (0 /* nullptr */ == filename) {
+    warning(WARN_MISSING, "%1 expects argument", rd);
+    tok.next();
+    return;
+  }
   errno = 0;
   FILE *fp = include_search_path.open_file_cautiously(filename);
   if (fp != 0 /* nullptr */)




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68783>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to