* src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/ChangeLog b/ChangeLog
index 57753f2..35b18c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2017-06-01 Werner Lemberg <wl@gnu.org>
+ * src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'.
+
+2017-06-01 Werner Lemberg <wl@gnu.org>
+
[psaux] 32bit integer overflow tun-time errors (#46149).
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 9bfb330..62d94cb 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -408,6 +408,19 @@
goto Exit;
/* copy advance while converting 26.6 to 16.16 format */
+ if ( slot->advance.x >= 0x8000L * 64 ||
+ slot->advance.x <= -0x8000L * 64 )
+ {
+ FT_ERROR(( "FT_Get_Glyph: advance width too large\n" ));
+ return FT_THROW( Invalid_Argument );
+ }
+ if ( slot->advance.y >= 0x8000L * 64 ||
+ slot->advance.y <= -0x8000L * 64 )
+ {
+ FT_ERROR(( "FT_Get_Glyph: advance height too large\n" ));
+ return FT_THROW( Invalid_Argument );
+ }
+
glyph->advance.x = slot->advance.x * 1024;
glyph->advance.y = slot->advance.y * 1024;