Commit 8b6bcc92c5907cfad9e20b1b7bfaef96e2d93ebf

Alexei Podtelezhnikov 2022-06-12T09:04:13

* src/sfnt/sfwoff2.c (woff2_open_font): Partial revert. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47981.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
index fd9674d..049a142 100644
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -2004,7 +2004,8 @@
 
       FT_TRACE4(( "Number of fonts in TTC: %d\n", woff2.num_fonts ));
 
-      if ( FT_QNEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) )
+      /* pre-zero pointers within in case of failure */
+      if ( FT_NEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) )
         goto Exit;
 
       for ( nn = 0; nn < woff2.num_fonts; nn++ )