groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 05/80: [libgroff]: Fix Savannah #66473.


From: G. Branden Robinson
Subject: [groff] 05/80: [libgroff]: Fix Savannah #66473.
Date: Sat, 30 Nov 2024 04:02:11 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit ef296d8353dd32609b0a2a512d9287d5f8383eb7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Nov 21 21:15:18 2024 -0600

    [libgroff]: Fix Savannah #66473.
    
    * src/libs/libgroff/font.cpp (font::load): Declare `start_code` and
      `end_code` as `unsigned` integers, since Unicode code points cannot be
      negative, and we are using the sscanf(3) conversion specifier `%X` to
      read them from a font description file.
    
    Fixes <https://savannah.gnu.org/bugs/?66473>.  Thanks to Bjarni Ingi
    Gislason for the report.
---
 ChangeLog                  | 10 ++++++++++
 src/libs/libgroff/font.cpp |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eb620971c..af8e607c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-11-21  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/libs/libgroff/font.cpp (font::load): Declare `start_code`
+       and `end_code` as `unsigned` integers, since Unicode code points
+       cannot be negative, and we are using the sscanf(3) conversion
+       specifier `%X` to read them from a font description file.
+
+       Fixes <https://savannah.gnu.org/bugs/?66473>.  Thanks to Bjarni
+       Ingi Gislason for the report.
+
 2024-11-21  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * m4/groff.m4 (GROFF_PROG_M4): Also search for `gm4`.  Obviates
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp
index 27c213209..ef98e01e9 100644
--- a/src/libs/libgroff/font.cpp
+++ b/src/libs/libgroff/font.cpp
@@ -1042,8 +1042,8 @@ bool font::load(bool load_header_only)
          directive = nm;
          break;
        }
-       int start_code = 0;
-       int end_code = 0;
+       unsigned int start_code = 0;
+       unsigned int end_code = 0;
        int nrange = sscanf(nm, "u%X..u%X", &start_code, &end_code);
        // TODO: Check for backwards range: end_code < start_code.
        if (2 == nrange) {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]