]> git.imager.perl.org - imager.git/commitdiff
fix an unsigned comparison when converting character code to a glyph index with a...
authorTony Cook <tony@develop-help.com>
Sun, 6 Jan 2019 04:11:01 +0000 (15:11 +1100)
committerTony Cook <tony@develop-help.com>
Sun, 6 Jan 2019 04:11:01 +0000 (15:11 +1100)
Changes
fontft1.c

diff --git a/Changes b/Changes
index 7bf5764d6ee554889e9efa9ee767b6b43d6273fe..b6c0f94805926bf6a0210894aac7138f442c4a5e 100644 (file)
--- a/Changes
+++ b/Changes
@@ -105,6 +105,10 @@ High severity:
  - handle failure to clone the log filehandle when cloning the Imager
    context object on thread creation.  CID 185294.
 
+ - fix an unsigned comparison when converting character code to a
+   glyph index with a NULL character map.  This should be rare.  CID
+   185297.
+
 [1] The first two build submissions ended up at the end of a ~400
 build queue, and seemed to have been cancelled by Coverity.  A build
 submitted on NYE went through in minutes.
index cf2043f70c4bc63902386ec3462bf708d33b0c8a..dd142295eb934b5623f8290dd115c885546b2c87 100644 (file)
--- a/fontft1.c
+++ b/fontft1.c
@@ -613,7 +613,7 @@ i_tt_get_glyph( TT_Fonthandle *handle, int inst, unsigned long j) {
   if ( LTT_hinted ) load_flags |= TTLOAD_HINT_GLYPH;
   
   if ( !TT_VALID(handle->char_map) ) {
-    code = (j - ' ' + 1) < 0 ? 0 : (j - ' ' + 1);
+    code = (j < ' ' - 1)  ? 0 : (j - (' ' - 1));
     if ( code >= handle->properties.num_Glyphs ) code = 0;
   } else code = TT_Char_Index( handle->char_map, j );