Add underflow detection to TTF cmap code.

This commit is contained in:
Michael R Sweet
2025-08-27 11:19:35 -04:00
parent ccf3a90c97
commit 359b65298e
2 changed files with 7 additions and 1 deletions

View File

@@ -21,6 +21,12 @@ v1.6.0 - YYYY-MM-DD
(Issue #104)
v1.5.5 - YYYY-MM-DD
-------------------
- Fixed TTF cmap underflow error.
v1.5.4 - 2025-08-26
-------------------

2
ttf.c
View File

@@ -1379,7 +1379,7 @@ read_cmap(ttf_t *font) // I - Font
/* language = */ read_ushort(font);
if (length > (256 + 6))
if (length > (256 + 6) || length < 7)
{
errorf(font, "Bad cmap table length at offset %u.", coffset);
return (false);