Update of bug #68791 (group groff):

         Planned Release:                    None => 1.25.0
                 Summary: [troff] `rm` request stops processing arguments upon
encountering an invalid one => [PATCH] [troff] `rm` request stops processing
arguments upon encountering an invalid one

    _______________________________________________________

Follow-up Comment #1:

Two commits are necessary to fix this one.


commit 186dfc5687516f30822cbe4410becc77b68eb8ba
Author: G. Branden Robinson <[email protected]>
Date:   Sat Oct 17 17:56:46 2026 -0500

    XXX [troff]: Adjust `rm` request handler.
    
    * src/roff/troff/input.cpp (remove_macro): Add early loop termination
      condition; `break` when `has_arg()` returns false.  This changes no
      observable behavior right now, but prepares for a bug fix.

diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index fb149d133..0eaf52fb1 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5821,6 +5821,8 @@ static void remove_macro() // .rm
     if (s.is_null())
       break;
     request_dictionary.remove(s);
+    if (!has_arg())
+      break;
   }
   skip_line();
 }


commit d598a6539b480a822a7f87c38170900bcf8cd97e
Author: G. Branden Robinson <[email protected]>
Date:   Sat Oct 17 17:50:30 2026 -0500

    XXX [troff]: Fix Savannah #68791.

diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 0eaf52fb1..f83b9eb7c 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5818,8 +5818,11 @@ static void remove_macro() // .rm
   }
   for (;;) {
     symbol s = read_identifier();
-    if (s.is_null())
-      break;
+    if (s.is_null()) {
+      warning(WARN_SYNTAX, "ignoring invalid identifier"
+             " given as argment to name removal request");
+      skip_rest_of_argument();
+    }
     request_dictionary.remove(s);
     if (!has_arg())
       break;




    _______________________________________________________

Reply to this item at:

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

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

Attachment: signature.asc
Description: PGP signature

Reply via email to