summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2025-04-14 21:37:18 +0200
committerWerner Lemberg <wl@gnu.org>2025-04-14 21:37:18 +0200
commit558bde6e39be0079e4debc70759535a4756d4ce6 (patch)
tree2661963ddf69e327f4c5f6d0206029ff72438426
parentae3879c0a1214faa59fb598bf7d5a38bb35c054b (diff)
[autofit] Fix just introduced heap buffer overflow
Reported as https://issues.oss-fuzz.com/issues/410393975 * src/autofit/afadjust.c [!FT_CONFIG_OPTION_USE_HARFBUZZ]: Synchronize with HarfBuzz code.
-rw-r--r--src/autofit/afadjust.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/autofit/afadjust.c b/src/autofit/afadjust.c
index 54ec2ffb9..176d5fe48 100644
--- a/src/autofit/afadjust.c
+++ b/src/autofit/afadjust.c
@@ -779,6 +779,8 @@
{
FT_UInt i;
+ FT_Long insert_point;
+
#ifdef FT_DEBUG_LEVEL_TRACE
int failed_lookups = 0;
#endif
@@ -802,9 +804,11 @@
if ( error )
goto Exit;
+ insert_point = ( *map )-> length;
+
( *map )->length++;
- ( *map )->entries[i].glyph_index = glyph;
- ( *map )->entries[i].codepoint = codepoint;
+ ( *map )->entries[insert_point].glyph_index = glyph;
+ ( *map )->entries[insert_point].codepoint = codepoint;
}
}