shithub: freetype+ttf2subf

Download patch

ref: 9b15ea341c28fe5ac8dcb77861122b28913d545d
parent: ad83071620f6c4c3bf029beec761f710e9bbea17
author: Werner Lemberg <[email protected]>
date: Fri Sep 29 14:22:11 EDT 2006

* src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Fix algorithm for
overlapping segments.  Bug reported by Stefan Koch.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-29  Werner Lemberg  <[email protected]>
+
+	* src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Fix algorithm for
+	overlapping segments.  Bug reported by Stefan Koch.
+
 2006-09-28  David Turner  <[email protected]>
 
         * include/freetype/internal/ftobjs.h, src/truetype/ttobjs.c,
--- 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;