* src/sfnt/sfwoff2.c (reconstruct_glyf): Check `triplet_size'. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18108
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/ChangeLog b/ChangeLog
index 8fad2ed..ba34606 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,17 @@
+2019-10-10 Werner Lemberg <wl@gnu.org>
+
+ * src/sfnt/sfwoff2.c (reconstruct_glyf): Check `triplet_size'.
+
+ Reported as
+
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18108
+
2019-10-09 John Tytgat <John.Tytgat@esko.com>
[cff] Fix FT_FACE_FLAG_GLYPH_NAMES for CFF2 based fonts (#57023).
- * src/cff/cffobjs.c (cff_face_init): Don't set FT_FACE_FLAG_GLYPH_NAMES
- for CFF2 based fonts.
+ * src/cff/cffobjs.c (cff_face_init): Don't set
+ FT_FACE_FLAG_GLYPH_NAMES for CFF2 based fonts.
2019-10-08 Werner Lemberg <wl@gnu.org>
diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
index 01d5bb2..db0fb7a 100644
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -1070,6 +1070,11 @@
flags_buf = stream->base + substreams[FLAG_STREAM].offset;
triplet_buf = stream->base + substreams[GLYPH_STREAM].offset;
+ if ( substreams[GLYPH_STREAM].size <
+ ( substreams[GLYPH_STREAM].offset -
+ substreams[GLYPH_STREAM].start ) )
+ goto Fail;
+
triplet_size = substreams[GLYPH_STREAM].size -
( substreams[GLYPH_STREAM].offset -
substreams[GLYPH_STREAM].start );