Fix handling of invalid format 2 cmaps. The problem was introduced after the last release. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7828 * src/sfnt/ttcmap.c (tt_cmap2_char_next): Avoid endless loop.
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
diff --git a/ChangeLog b/ChangeLog
index c3788a9..99fca5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2018-03-13 Werner Lemberg <wl@gnu.org>
+
+ Fix handling of invalid format 2 cmaps.
+
+ The problem was introduced after the last release.
+
+ Reported as
+
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7828
+
+ * src/sfnt/ttcmap.c (tt_cmap2_char_next): Avoid endless loop.
+
2018-04-17 Werner Lemberg <wl@gnu.org>
[truetype] Integer overflow issues.
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index dcde869..71a3c1e 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -518,6 +518,13 @@
FT_UInt pos, idx;
+ if ( char_lo > start + count )
+ {
+ /* this happens only for a malformed cmap */
+ charcode = 0x100;
+ continue;
+ }
+
if ( offset == 0 )
{
if ( charcode == 0x100 )