gbranden pushed a commit to branch master
in repository groff.

commit 2500bfb7a40e8c8cd7ef13d71f6babdc3c5aa477
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Aug 28 19:56:06 2024 -0500

    src/roff/troff/input.cpp: Fix logic nit.
    
    * src/roff/troff/input.cpp (encode_special_character_for_device_output):
      Require a non-empty special character escape sequence argument in
      _both_ paths through the start of the function.
---
 ChangeLog                | 7 +++++++
 src/roff/troff/input.cpp | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 70506000b..cc3db925e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-08-28  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp
+       (encode_special_character_for_device_output): Require a
+       non-empty special character escape sequence argument in _both_
+       paths through the start of the function.
+
 2024-08-28  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/div.cpp: Trivially refactor.  Rename and
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 34960cee4..10e6f92a4 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1017,6 +1017,8 @@ static symbol read_long_escape_parameters(read_mode mode)
   if (buf == abuf) {
     if (i == 0) {
       if (mode != ALLOW_EMPTY)
+       // XXX: `.device \[]` passes through as-is but `\X \[]` doesn't,
+       // landing here.  Implement almost-but-not-quite-copy-mode?
        copy_mode_error("empty escape sequence argument in copy mode");
       return EMPTY_SYMBOL;
     }
@@ -5701,7 +5703,7 @@ static void 
encode_special_character_for_device_output(macro *mac)
     sc = ci->get_symbol()->contents();
   }
   else
-    sc = tok.get_char()->get_symbol()->contents();
+    sc = tok.get_char(true /* required */)->get_symbol()->contents();
   if (strcmp("-", sc) == 0)
     mac->append('-');
   else if (strcmp("aq", sc) == 0)

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to