shithub: freetype+ttf2subf

Download patch

ref: 396b11b840f84e8bff62f3c361d0b592e77ee703
parent: 9ec31cea16a492bed96a96a7c30c1a466adb9792
author: Werner Lemberg <[email protected]>
date: Thu Dec 9 18:16:18 EST 2010

[cff] Allow `hlineto' and `vlineto' without arguments.

We simply ignore such instructions.  This is invalid, but it doesn't
harm; and indeed, there exist such subsetted fonts in PDFs.

Reported by Albert Astals Cid <[email protected]>.

* src/cff/cffgload.c (cff_decoder_parse_charstrings)
[cff_op_hlineto]: Ignore instruction if there aren't any arguments
on the stack.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-12-09  Werner Lemberg  <[email protected]>
+
+	[cff] Allow `hlineto' and `vlineto' without arguments.
+
+	We simply ignore such instructions.  This is invalid, but it doesn't
+	harm; and indeed, there exist such subsetted fonts in PDFs.
+
+	Reported by Albert Astals Cid <[email protected]>.
+
+	* src/cff/cffgload.c (cff_decoder_parse_charstrings)
+	[cff_op_hlineto]: Ignore instruction if there aren't any arguments
+	on the stack.
+
 2010-11-28  Werner Lemberg  <[email protected]>
 
 	* Version 2.4.4 released.
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -1438,8 +1438,13 @@
             FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n"
                                              : " vlineto\n" ));
 
-            if ( num_args < 1 )
+            if ( num_args < 0 )
               goto Stack_Underflow;
+
+            /* there exist subsetted fonts (found in PDFs) */
+            /* which call `hlineto' without arguments      */
+            if ( num_args == 0 )
+              break;
 
             if ( cff_builder_start_point ( builder, x, y ) ||
                  check_points( builder, num_args )         )