shithub: freetype+ttf2subf

Download patch

ref: 2dc76a46509d1acbbbdf82987a690c0f9f777b92
parent: 0ae3271814982524dfd210dee09031c2430d473f
author: Werner Lemberg <[email protected]>
date: Mon Jul 5 02:40:02 EDT 2010

[cff] Next try to fix `hintmask' and `cntrmask' limit check.

Problem reported by malc <[email protected]>.

* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_hintmask>: It is possible that there is just a single byte
after the `hintmask' or `cntrmask', e.g., a `return' instruction.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-07-05  Werner Lemberg  <[email protected]>
+
+	[cff] Next try to fix `hintmask' and `cntrmask' limit check.
+
+	Problem reported by malc <[email protected]>.
+
+	* src/cff/cffgload.c (cff_decoder_parse_charstrings)
+	<cff_op_hintmask>: It is possible that there is just a single byte
+	after the `hintmask' or `cntrmask', e.g., a `return' instruction.
+
 2010-07-04  suzuki toshiya  <[email protected]>
 
 	Restrict the number of the charmaps in a rogue-compatible mode.
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -1339,12 +1339,12 @@
             decoder->num_hints += num_args / 2;
           }
 
-          /* In a valid charstring there must be at least three bytes */
-          /* after `hintmask' or `cntrmask' (two for a `moveto'       */
-          /* operator and one for `endchar').  Additionally, there    */
-          /* must be space for `num_hints' bits.                      */
+          /* In a valid charstring there must be at least one byte */
+          /* after `hintmask' or `cntrmask' (e.g., for a `return'  */
+          /* instruction).  Additionally, there must be space for  */
+          /* `num_hints' bits.                                     */
 
-          if ( ( ip + 3 + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit )
+          if ( ( ip + 1 + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit )
             goto Syntax_Error;
 
           if ( hinter )