From 705012948aa917f6676c8e67fe29bf7d7ff6651f Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Sun, 6 Jan 2019 15:11:01 +1100 Subject: [PATCH] fix an unsigned comparison when converting character code to a glyph index with a NULL character map --- Changes | 4 ++++ fontft1.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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 ); -- 2.39.5