]> git.imager.perl.org - imager.git/commitdiff
prevent an unsigned overflow in FT1 has_chars() implementation
authorTony Cook <tony@develop-help.com>
Mon, 7 Jan 2019 11:37:19 +0000 (22:37 +1100)
committerTony Cook <tony@develop-help.com>
Mon, 7 Jan 2019 11:37:19 +0000 (22:37 +1100)
Changes
fontft1.c

diff --git a/Changes b/Changes
index 3c58eb5706b04193558c1d87299bbef67cdadfd5..4ee4a8be079f702ca87dd80299f89dd834d9c26f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -61,7 +61,7 @@ High severity:
    i_get_combine() due to a fencepost error in validating the combine
    number.  CID 185299.
 
-
+Lower severity (according to Coverity):
 
  - avoid an unneeded EXTEND() call when the FT1 has_chars()
    implementation returns 0. CID 185350.
@@ -109,8 +109,11 @@ High severity:
    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.
+   glyph index with a NULL character map when calculating the glyph
+   for display for FT1.  This should be rare.  CID 185297.
+
+ - fix a similar bug when calculating whether a glyph is present for
+   has_chars() for FT1.  CID 185302.
 
  - i_img_info() (C API) no longer tries to handle a NULL image object
    pointer.  CID 185298.
index dd142295eb934b5623f8290dd115c885546b2c87..50602902d3c9ef750c23e426fb33ce4d0283aef4 100644 (file)
--- a/fontft1.c
+++ b/fontft1.c
@@ -687,7 +687,7 @@ i_tt_has_chars(TT_Fonthandle *handle, char const *text, size_t len, int utf8,
       index = TT_Char_Index(handle->char_map, c);
     }
     else {
-      index = (c - ' ' + 1) < 0 ? 0 : (c - ' ' + 1);
+      index = (c < ' ' - 1) ? 0 : (c - (' ' - 1));
       if (index >= handle->properties.num_Glyphs)
         index = 0;
     }