From 13c4a4f171877c751ff621af2860abb5b3f00de7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 23 Apr 2003 18:21:48 +0000 Subject: [PATCH] * src/sfnt/ttcmap0.c (tt_cmap4_validate): Provide a weak variant of the glyph ID bounding check if FT_VALIDATE_TIGHT is not active. Without this change, many CJK fonts from Dynalab are rejected. --- ChangeLog | 6 ++++++ src/sfnt/ttcmap0.c | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 387879e7f..dd78eb332 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-04-23 Akito Hirai + + * src/sfnt/ttcmap0.c (tt_cmap4_validate): Provide a weak variant + of the glyph ID bounding check if FT_VALIDATE_TIGHT is not active. + Without this change, many CJK fonts from Dynalab are rejected. + 2003-04-23 Joe Marcus Clarke * src/base/ftbdf.c (FT_Get_BDF_Property): Check for valid diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c index 405334577..613a9f8ec 100644 --- a/src/sfnt/ttcmap0.c +++ b/src/sfnt/ttcmap0.c @@ -4,7 +4,7 @@ /* */ /* TrueType new character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002 by */ +/* Copyright 2002, 2003 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -701,9 +701,18 @@ p += offset; /* start of glyph id array */ /* check that we point within the glyph ids table only */ - if ( p < glyph_ids || - p + ( end - start + 1 ) * 2 > table + length ) - FT_INVALID_DATA; + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + if ( p < glyph_ids || + p + ( end - start + 1 ) * 2 > table + length ) + FT_INVALID_DATA; + } + else + { + if ( p < glyph_ids || + p + ( end - start + 1 ) * 2 > valid->limit ) + FT_INVALID_DATA; + } /* check glyph indices within the segment range */ if ( valid->level >= FT_VALIDATE_TIGHT )