shithub: freetype+ttf2subf

Download patch

ref: c838c4f7b50e20010e6a014b8f92fdc080950184
parent: 9db9adda0f15ab9eb53a4f393887d8c567ee9d67
author: Werner Lemberg <[email protected]>
date: Thu Sep 17 12:22:40 EDT 2015

[pcf] Fix integer overflows (#45985).

* src/pcf/pcfread.c (pcf_load_font): Use FT_MulDiv.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2015-09-17  Werner Lemberg  <[email protected]>
 
+	[pcf] Fix integer overflows (#45985).
+
+	* src/pcf/pcfread.c (pcf_load_font): Use FT_MulDiv.
+
+2015-09-17  Werner Lemberg  <[email protected]>
+
 	[pcf] Use FT_ABS for some property values (#45893).
 
 	* src/pcf/pcfread.c (pcf_load_font): Take absolute values for
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -1290,7 +1290,7 @@
           bsize->width = (FT_Short)( ( FT_ABS( prop->value.l ) + 5 ) / 10 );
         }
         else
-          bsize->width = (FT_Short)( bsize->height * 2 / 3 );
+          bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 );
 
         prop = pcf_find_property( face, "POINT_SIZE" );
         if ( prop )
@@ -1339,10 +1339,12 @@
         {
           bsize->y_ppem = bsize->size;
           if ( resolution_y )
-            bsize->y_ppem = bsize->y_ppem * resolution_y / 72;
+            bsize->y_ppem = FT_MulDiv( bsize->y_ppem, resolution_y, 72 );
         }
         if ( resolution_x && resolution_y )
-          bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y;
+          bsize->x_ppem = FT_MulDiv( bsize->y_ppem,
+                                     resolution_x,
+                                     resolution_y );
         else
           bsize->x_ppem = bsize->y_ppem;
       }