From 7e01451b18d142342dc71f32168a5dfb45221bb2 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 21 Aug 2024 08:22:31 -0400 Subject: [PATCH] Merge 0-character font fix from TTF. --- ttf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ttf.c b/ttf.c index 5241fb2..71af3ec 100644 --- a/ttf.c +++ b/ttf.c @@ -1323,7 +1323,7 @@ read_cmap(ttf_t *font) // I - Font TTF_DEBUG("read_cmap: glyphIdArray[%d]=%d\n", i, glyphIdArray[i]); #endif /* DEBUG */ - if (font->num_cmap > TTF_FONT_MAX_CHAR) + if (font->num_cmap == 0 || font->num_cmap > TTF_FONT_MAX_CHAR) { errorf(font, "Invalid cmap table with %u characters.", (unsigned)font->num_cmap); return (false); @@ -1433,7 +1433,7 @@ read_cmap(ttf_t *font) // I - Font // uncompressed cmap table... TTF_DEBUG("read_cmap: num_cmap=%u\n", (unsigned)font->num_cmap); - if (font->num_cmap > TTF_FONT_MAX_CHAR) + if (font->num_cmap == 0 || font->num_cmap > TTF_FONT_MAX_CHAR) { errorf(font, "Invalid cmap table with %u characters.", (unsigned)font->num_cmap); return (false); @@ -1522,7 +1522,7 @@ read_cmap(ttf_t *font) // I - Font // uncompressed cmap table... TTF_DEBUG("read_cmap: num_cmap=%u\n", (unsigned)font->num_cmap); - if (font->num_cmap > TTF_FONT_MAX_CHAR) + if (font->num_cmap == 0 || font->num_cmap > TTF_FONT_MAX_CHAR) { errorf(font, "Invalid cmap table with %u characters.", (unsigned)font->num_cmap); return (false);