ref: c94162a2200c16e9614289cf91d6bf0e0b01a01f
parent: 33cd1eedcf4de94eee1dae5753b974f893506a9f
author: Young Xiao <[email protected]>
date: Thu Aug 16 04:25:47 EDT 2018
* builds/mac/ftmac.c (parse_fond): Fix buffer overrun. Reported as bug #54515, duplicate of #43540.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-16 Young Xiao <[email protected]>
+
+ * builds/mac/ftmac.c (parse_fond): Fix buffer overrun.
+
+ Reported as bug #54515, duplicate of #43540.
+
2018-08-16 Werner Lemberg <[email protected]>
* builds/*/ftsystem.c (FT_COMPONENT): Updated also.
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -780,9 +780,10 @@
style = (StyleTable*)p;
p += sizeof ( StyleTable );
string_count = EndianS16_BtoN( *(short*)(p) );
+ string_count = FT_MIN( 64, string_count );
p += sizeof ( short );
- for ( i = 0; i < string_count && i < 64; i++ )
+ for ( i = 0; i < string_count; i++ )
{
names[i] = p;
p += names[i][0];
@@ -799,7 +800,7 @@
ps_name[ps_name_len] = 0;
}
if ( style->indexes[face_index] > 1 &&
- style->indexes[face_index] <= FT_MIN( string_count, 64 ) )
+ style->indexes[face_index] <= string_count )
{
unsigned char* suffixes = names[style->indexes[face_index] - 1];