shithub: freetype+ttf2subf

Download patch

ref: 481838e2347b9bd7e3a5f580eb6afa967e0c92f6
parent: 6cda6c064fdb2d1df851f5f54e164341e3c1fe8f
author: David Turner <[email protected]>
date: Thu Feb 23 07:40:14 EST 2006

* src/bdf/bdflib.c: fixed a problem with large encodings.
    Again, this patch comes from Debian libfreetype6 for 2.1.10 !

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
     this patch comes from the Debian package for libfreetype6 !!
     How come nobody mentions this on the devel list ??
 
+    * src/bdf/bdflib.c: fixed a problem with large encodings.
+    Again, this patch comes from Debian libfreetype6 for 2.1.10 !
+
 2006-02-23  Chia-I Wu  <[email protected]>
 
 	* include/freetype/ftoutln.h (enum FT_Orientation): New value
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1561,6 +1561,14 @@
 
       p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 );
 
+      /* Check that the encoding is in the range [0,65536] because        */
+      /* otherwise p->have (a bitmap with static size) overflows.         */
+      if ( p->glyph_enc >= sizeof(p->have)*8 )
+      {
+        error = BDF_Err_Invalid_File_Format;
+        goto Exit;
+      }
+
       /* Check to see whether this encoding has already been encountered. */
       /* If it has then change it to unencoded so it gets added if        */
       /* indicated.                                                       */