From 3739f8b987ef385fdaefc887922f76c9d0066311 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 18 Jan 2009 13:13:17 +0000 Subject: [PATCH] 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 . --- ChangeLog | 9 +++++++++ src/sfnt/ttcmap.c | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index db314b247..911d48bbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-01-18 Werner Lemberg + + 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 . + 2009-01-18 Werner Lemberg Implement FT_Get_Name_Index for SFNT driver. diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index efd079f1f..67b6684c6 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;