diff options
author | marha <marha@users.sourceforge.net> | 2010-08-06 11:48:36 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-08-06 11:48:36 +0000 |
commit | 20ff8ddf2d9bb41050d10bbc75d61b9161880c7c (patch) | |
tree | 22566fcd9663b2baa565cd0c64eaa662d6ba03ee /freetype/src/cache/ftccmap.c | |
parent | c29011f2831315d3da9c4727c1e626d80520b97a (diff) | |
parent | 6849d83857b4e470a44ad8b6aa5cfb283fd64c89 (diff) | |
download | vcxsrv-20ff8ddf2d9bb41050d10bbc75d61b9161880c7c.tar.gz vcxsrv-20ff8ddf2d9bb41050d10bbc75d61b9161880c7c.tar.bz2 vcxsrv-20ff8ddf2d9bb41050d10bbc75d61b9161880c7c.zip |
svn merge ^/branches/released .
Diffstat (limited to 'freetype/src/cache/ftccmap.c')
-rw-r--r-- | freetype/src/cache/ftccmap.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/freetype/src/cache/ftccmap.c b/freetype/src/cache/ftccmap.c index 6728ad317..bc0e66075 100644 --- a/freetype/src/cache/ftccmap.c +++ b/freetype/src/cache/ftccmap.c @@ -4,7 +4,8 @@ /* */ /* FreeType CharMap cache (body) */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -153,7 +154,7 @@ FTC_CMapQuery query = (FTC_CMapQuery)ftcquery; FT_Error error; FT_Memory memory = cache->memory; - FTC_CMapNode node; + FTC_CMapNode node = NULL; FT_UInt nn; @@ -310,19 +311,11 @@ #ifdef FT_CONFIG_OPTION_OLD_INTERNALS /* - * Detect a call from a rogue client that thinks it is linking - * to FreeType 2.1.7. This is possible because the third parameter - * is then a character code, and we have never seen any font with - * more than a few charmaps, so if the index is very large... - * - * It is also very unlikely that a rogue client is interested - * in Unicode values 0 to 15. - * - * NOTE: The original threshold was 4, but we found a font from the - * Adobe Acrobat Reader Pack, named `KozMinProVI-Regular.otf', - * which contains more than 5 charmaps. + * If cmap_index is greater than the maximum number of cachable + * charmaps, we assume the request is from a legacy rogue client + * using old internal header. See include/config/ftoption.h. */ - if ( cmap_index >= 16 && !no_cmap_change ) + if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change ) { FTC_OldCMapDesc desc = (FTC_OldCMapDesc) face_id; @@ -384,7 +377,7 @@ /* something rotten can happen with rogue clients */ if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >= FTC_CMAP_INDICES_MAX ) ) - return 0; + return 0; /* XXX: should return appropriate error */ gindex = FTC_CMAP_NODE( node )->indices[char_code - FTC_CMAP_NODE( node )->first]; @@ -401,6 +394,12 @@ if ( error ) goto Exit; +#ifdef FT_MAX_CHARMAP_CACHEABLE + /* something rotten can happen with rogue clients */ + if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE ) + return 0; /* XXX: should return appropriate error */ +#endif + if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps ) { FT_CharMap old, cmap = NULL; |