Merge 0-character font fix from TTF.

This commit is contained in:
Michael R Sweet 2024-08-21 08:22:31 -04:00
parent 138f3955d1
commit 7e01451b18
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244

6
ttf.c
View File

@ -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);