gbranden pushed a commit to branch master
in repository groff.

commit feb92d80933f13bd639d3d4962c279463e729188
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Jul 13 10:32:52 2026 -0500

    [troff]: Fix Savannah #68521.
    
    * src/roff/troff/input.cpp (token::next): Perform range check on
      parameter to `\N` escape sequence; throw error diagnostic if it fails.
    
    Fixes <https://savannah.gnu.org/bugs/?68521>.  Problem introduced by me
    in commit b039f8c3d1, 2025-03-29, an attempt to improve compatibility
    with DWB troff.  (But as noted in that commit, DWB troff appears not to
    _exercise_ its freedom to employ negative character indices.)
---
 ChangeLog                | 12 ++++++++++++
 src/roff/troff/input.cpp |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 4186dcecb..4b6629c3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2026-07-13  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (token::next): Perform range check on
+       parameter to `\N` escape sequence; throw error diagnostic if it
+       fails.
+
+       Fixes <https://savannah.gnu.org/bugs/?68521>.  Problem
+       introduced by me in commit b039f8c3d1, 2025-03-29, an attempt to
+       improve compatibility with DWB troff.  (But as noted in that
+       commit, DWB troff appears not to _exercise_ its freedom to
+       employ negative character indices.)
+
 2026-07-13  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp (charinfo::set_number)
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index c4b65e98f..087fe2176 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2687,6 +2687,11 @@ void token::next()
        // The argument is a glyph index, which is dimensionless.
        if (!read_delimited_measurement(&val, 0 /* dimensionless */))
          break;
+       if (val < 0) {
+         error("expected nonnegative indexed character value; got %1",
+               val);
+         break;
+       }
        type = TOKEN_INDEXED_CHAR;
        return;
       case 'o':

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

Reply via email to