shithub: freetype+ttf2subf

Download patch

ref: 0ad326236607df0802dc72c4f13b3f35484b7672
parent: 4a1f1a6d2a5118ae45f0f950a824ad7a1363a044
author: Werner Lemberg <[email protected]>
date: Thu Jun 1 13:00:37 EDT 2017

* src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-06-01  Werner Lemberg  <[email protected]>
 
+	* src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'.
+
+2017-06-01  Werner Lemberg  <[email protected]>
+
 	[psaux] 32bit integer overflow tun-time errors (#46149).
 
 	* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use
--- 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;