shithub: freetype+ttf2subf

Download patch

ref: 13c4a4f171877c751ff621af2860abb5b3f00de7
parent: 8b61525b9ac44d4ca37524b7e3b588e9f3c9870d
author: Werner Lemberg <[email protected]>
date: Wed Apr 23 14:21:48 EDT 2003

* 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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-04-23  Akito Hirai  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* src/base/ftbdf.c (FT_Get_BDF_Property): Check for valid
--- 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 )