shithub: freetype+ttf2subf

Download patch

ref: 76accc184bda4a417001e5fde08dcd670b4a95d5
parent: 2df16761c93bd0d49c0b7e3c6df9e05a3b8a763e
author: Bram Tassyns <[email protected]>
date: Wed Oct 17 15:55:20 EDT 2012

[cff] Fix value overflow.

* src/cff/cffparse.c (cff_parse_fixed_scaled): Implement it.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-10-17  Bram Tassyns  <[email protected]>
+
+	[cff] Fix value overflow.
+
+	* src/cff/cffparse.c (cff_parse_fixed_scaled): Implement it.
+
 2012-10-17  Werner Lemberg  <[email protected]>
 
 	[truetype] Fix Savannah bug #37572.
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -396,9 +396,20 @@
   cff_parse_fixed_scaled( FT_Byte**  d,
                           FT_Long    scaling )
   {
-    return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
-                     : ( cff_parse_integer( d[0], d[1] ) *
-                           power_tens[scaling] ) << 16;
+    if ( **d == 30 )
+      return cff_parse_real( d[0], d[1], scaling, NULL );
+    else
+    {
+      FT_Long  val = cff_parse_integer( d[0], d[1] ) * power_tens[scaling];
+
+
+      if ( val > 0x7FFF )
+        return 0x7FFFFFFFL;
+      else if ( val < -0x7FFF )
+        return -0x7FFFFFFFL;
+
+      return val << 16;
+    }
   }