* src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Fix algorithm for overlapping segments. Bug reported by Stefan Koch.
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
diff --git a/ChangeLog b/ChangeLog
index fa747bb..d436f20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-29 Werner Lemberg <wl@gnu.org>
+
+ * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Fix algorithm for
+ overlapping segments. Bug reported by Stefan Koch.
+
2006-09-28 David Turner <david@freetype.org>
* include/freetype/internal/ftobjs.h, src/truetype/ttobjs.c,
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index ce1dc0c..7795105 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -1094,14 +1094,19 @@
/* search in segments before the current segment */
for ( i = max ; i > 0; i-- )
{
- FT_UInt prev_end;
+ FT_UInt prev_end;
+ FT_Byte* old_p;
- p = cmap->data + 14 + ( i - 1 ) * 2;
+ old_p = p;
+ p = cmap->data + 14 + ( i - 1 ) * 2;
prev_end = TT_PEEK_USHORT( p );
if ( charcode > prev_end )
+ {
+ p = old_p;
break;
+ }
end = prev_end;
p += 2 + num_segs2;