shithub: freetype+ttf2subf

Download patch

ref: b98133a4e9831544fec776757b2a6745d4ebc51e
parent: 9be385c94d63dd4951bb578a8417cf4a944ab827
author: Werner Lemberg <[email protected]>
date: Sun Jul 22 09:06:20 EDT 2018

* src/pcf/pcfread.c (pcf_get_encodings): Check index of defaultChar.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9527

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2018-07-22  Werner Lemberg  <[email protected]>
 
+	* src/pcf/pcfread.c (pcf_get_encodings): Check index of defaultChar.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9527
+
+2018-07-22  Werner Lemberg  <[email protected]>
+
 	* src/pcf/pcfread.c (pcf_load_font): Fix number of glyphs.
 
 	This is an oversight of the module change 2018-07-21.
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -1059,6 +1059,14 @@
     else
       defaultCharEncodingOffset = FT_PEEK_USHORT_LE( pos );
 
+    if ( defaultCharEncodingOffset >= face->nmetrics )
+    {
+      FT_TRACE0(( "pcf_get_encodings:"
+                  " Invalid glyph index for default character,"
+                  " setting to zero\n" ));
+      defaultCharEncodingOffset = 0;
+    }
+
     if ( defaultCharEncodingOffset )
     {
       /* do the swapping */