From: Tony Cook Date: Sun, 6 Jan 2019 04:11:01 +0000 (+1100) Subject: fix an unsigned comparison when converting character code to a glyph index with a... X-Git-Tag: v1.009~12 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/705012948aa917f6676c8e67fe29bf7d7ff6651f fix an unsigned comparison when converting character code to a glyph index with a NULL character map --- diff --git a/Changes b/Changes index 7bf5764d..b6c0f948 100644 --- 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. diff --git a/fontft1.c b/fontft1.c index cf2043f7..dd142295 100644 --- 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 );