Commit 3739f8b987ef385fdaefc887922f76c9d0066311

Werner Lemberg 2009-01-18T13:13:17

Protect FT_Get_Next_Char. * src/sfnt/ttcmap.c (tt_cmap4_set_range): Apply fix similar to change from 2008-07-22. Patch from Ronen Ghoshal <rghoshal@emtex.com>.

diff --git a/ChangeLog b/ChangeLog
index db314b2..911d48b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-01-18  Werner Lemberg  <wl@gnu.org>
 
+	Protect FT_Get_Next_Char.
+
+	* src/sfnt/ttcmap.c (tt_cmap4_set_range): Apply fix similar to
+	change from 2008-07-22.
+
+	Patch from Ronen Ghoshal <rghoshal@emtex.com>.
+
+2009-01-18  Werner Lemberg  <wl@gnu.org>
+
 	Implement FT_Get_Name_Index for SFNT driver.
 
 	* src/sfnt/sfdriver.c (sfnt_get_name_index): New function.
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index efd079f..67b6684 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType character mapping table (cmap) support (body).              */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by                  */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by            */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -697,6 +697,14 @@
       p     += num_ranges * 2;
       offset = FT_PEEK_USHORT( p );
 
+      /* some fonts handle the last segment incorrectly; */
+      /* we have to catch it                             */
+      if ( range_index     >= num_ranges - 1 &&
+           cmap->cur_start == 0xFFFFU        &&
+           cmap->cur_end   == 0xFFFFU        &&
+           cmap->cur_delta == 0x1U           )
+        offset = 0;
+
       if ( offset != 0xFFFFU )
       {
         cmap->cur_values = offset ? p + offset : NULL;