diff --git a/ChangeLog b/ChangeLog index cf5e2198d..72f377c20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-10-25 Werner Lemberg + + * 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 * src/sfnt/sfwoff2.c (woff2_open_font): Avoid undefined shift. diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c index 6896dc9d4..3134ccd53 100644 --- 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 ) )