From 1655e00fced6d16187fe2b3494d562795b2addd7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 19 Apr 2018 14:45:19 +0200 Subject: [PATCH] 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. --- ChangeLog | 12 ++++++++++++ src/sfnt/ttcmap.c | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index c3788a9da..99fca5d83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2018-03-13 Werner Lemberg + + 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 [truetype] Integer overflow issues. diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index dcde8693e..71a3c1e34 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 )