shithub: freetype+ttf2subf

Download patch

ref: 6c2ab0977cd6d443fe845f88c9846bda2944622a
parent: e9f4799940ae82a56d94c2751a6c1caf71f43cff
author: David Turner <[email protected]>
date: Sat Jun 16 12:40:37 EDT 2007

prevent a 16-bit integer overflow that would create problems when rendering
*very* large anti-aliased outlines

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-16  David Turner  <[email protected]>
+
+	* src/smooth/ftgrays.c (gray_hline): prevent integer overflows
+	when rendering *very* large outlines
+
+
 2006-06-16  Dmitry Timoshkov  <[email protected]>
 
 	* src/winfonts/winfnt.h: Add necessary structures for PE resource
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -397,6 +397,8 @@
     PCell  *pcell, cell;
     int     x = ras.ex;
 
+    if (x > ras.max_ex)
+      x = ras.max_ex;
 
     pcell = &ras.ycells[ras.ey];
     for (;;)
@@ -462,6 +464,10 @@
     /* All cells that are on the left of the clipping region go to the */
     /* min_ex - 1 horizontal position.                                 */
     ey -= ras.min_ey;
+
+    if (ex > ras.max_ex)
+      ex = ras.max_ex;
+
     ex -= ras.min_ex;
     if ( ex < 0 )
       ex = -1;
@@ -492,6 +498,9 @@
   gray_start_cell( RAS_ARG_ TCoord  ex,
                             TCoord  ey )
   {
+    if ( ex > ras.max_ex )
+      ex = (TCoord)( ras.max_ex );
+
     if ( ex < ras.min_ex )
       ex = (TCoord)( ras.min_ex - 1 );
 
@@ -1195,6 +1204,10 @@
 
     y += (TCoord)ras.min_ey;
     x += (TCoord)ras.min_ex;
+
+    /* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
+    if (x >= 32768)
+      x = 32767;
 
     if ( coverage )
     {