shithub: freetype+ttf2subf

Download patch

ref: b75031a26eed8838222ddb3a81bc1672a0e463a8
parent: 0a3d2bb99b45b72e1d45185ab054efa993d97210
author: Werner Lemberg <[email protected]>
date: Fri Oct 25 17:29:13 EDT 2019

* src/sfnt/sfwoff2.c (woff2_open_font): Check `num_fonts' for TTCs.

Reported as

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

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-10-25  Werner Lemberg  <[email protected]>
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Check `num_fonts' for TTCs.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18494
+
 2019-10-22  Werner Lemberg  <[email protected]>
 
 	* src/sfnt/sfwoff2.c (woff2_open_font): Avoid undefined shift.
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -1948,6 +1948,12 @@
       if ( READ_255USHORT( woff2.num_fonts ) )
         goto Exit;
 
+      if ( !woff2.num_fonts )
+      {
+        error = FT_THROW( Invalid_Table );
+        goto Exit;
+      }
+
       FT_TRACE4(( "Number of fonts in TTC: %ld\n", woff2.num_fonts ));
 
       if ( FT_NEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) )