File CVE-2025-23022.patch of Package freetype2.38427

--- freetype-2.6.3/src/cff/cf2ft.c	2025-04-25 07:42:08.298710261 +0200
+++ freetype-2.6.3/src/cff/cf2ft.c	2025-04-25 07:45:20.233203385 +0200
@@ -266,8 +266,8 @@
 
     if ( *hinted )
     {
-      *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64;
-      *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64;
+      *x_scale = ADD_INT32( decoder->builder.glyph->x_scale, 32 ) / 64;
+      *y_scale = ADD_INT32( decoder->builder.glyph->y_scale, 32 ) / 64;
     }
     else
     {
--- freetype-2.6.3/src/cff/cf2hints.c	2025-04-25 07:42:08.298809606 +0200
+++ freetype-2.6.3/src/cff/cf2hints.c	2025-04-25 08:58:05.364677497 +0200
@@ -74,8 +74,8 @@
     /* cross product of pt1 position from origin with pt2 position from  */
     /* pt1; we reduce the precision so that the result fits into 32 bits */
 
-    return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) -
-           ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 );
+    return ( x1 >> 16 ) * ( SUB_INT32( y2, y1 ) >> 16 ) -
+           ( y1 >> 16 ) * ( SUB_INT32( x2, x1 ) >> 16 );
   }
 
 
@@ -185,9 +185,9 @@
     /* darkening.  Bottoms are not changed; tops are incremented by twice */
     /* `darkenY'.                                                         */
     if ( cf2_hint_isTop( hint ) )
-      hint->csCoord += 2 * font->darkenY;
+      hint->csCoord = ADD_INT32( hint->csCoord, 2 * font->darkenY );
 
-    hint->csCoord += hintOrigin;
+    hint->csCoord  = ADD_INT32( hint->csCoord, hintOrigin );
     hint->scale    = scale;
     hint->index    = indexStemHint;   /* index in original stem hint array */
 
@@ -330,9 +330,9 @@
       if ( i == 0 && csCoord < hintmap->edge[0].csCoord )
       {
         /* special case for points below first edge: use uniform scale */
-        return FT_MulFix( csCoord - hintmap->edge[0].csCoord,
-                          hintmap->scale ) +
-                 hintmap->edge[0].dsCoord;
+        return ADD_INT32(
+                 FT_MulFix( csCoord - hintmap->edge[0].csCoord,
+                          hintmap->scale ), hintmap->edge[0].dsCoord );
       }
       else
       {
@@ -340,9 +340,9 @@
          * Note: entries with duplicate csCoord are allowed.
          * Use edge[i], the highest entry where csCoord >= entry[i].csCoord
          */
-        return FT_MulFix( csCoord - hintmap->edge[i].csCoord,
-                          hintmap->edge[i].scale ) +
-                 hintmap->edge[i].dsCoord;
+        return ADD_INT32(
+                 FT_MulFix( csCoord - hintmap->edge[i].csCoord,
+                          hintmap->edge[i].scale ), hintmap->edge[i].dsCoord );
       }
     }
   }
@@ -637,10 +637,10 @@
         /* to position the two edges.  This preserves the stem width.     */
         CF2_Fixed  midpoint  = cf2_hintmap_map(
                                  hintmap->initialHintMap,
-                                 ( secondHintEdge->csCoord +
+                                 ADD_INT32( secondHintEdge->csCoord,
                                    firstHintEdge->csCoord ) / 2 );
         CF2_Fixed  halfWidth = FT_MulFix(
-                                 ( secondHintEdge->csCoord -
+                                 SUB_INT32( secondHintEdge->csCoord,
                                    firstHintEdge->csCoord ) / 2,
                                  hintmap->scale );
 
@@ -1095,16 +1095,20 @@
     FT_Vector  pt;   /* hinted point in upright DS */
 
 
-    pt.x = FT_MulFix( glyphpath->scaleX, x ) +
-             FT_MulFix( glyphpath->scaleC, y );
+    pt.x = ADD_INT32( FT_MulFix( glyphpath->scaleX, x ),
+             FT_MulFix( glyphpath->scaleC, y ) );
     pt.y = cf2_hintmap_map( hintmap, y );
 
-    ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x )   +
-               FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) +
-               glyphpath->fractionalTranslation.x;
-    ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x )   +
-               FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) +
-               glyphpath->fractionalTranslation.y;
+    ppt->x = ADD_INT32(
+               FT_MulFix( glyphpath->font->outerTransform.a, pt.x ),
+               ADD_INT32(
+                 FT_MulFix( glyphpath->font->outerTransform.c, pt.y ),
+                 glyphpath->fractionalTranslation.x ) );
+    ppt->y = ADD_INT32(
+               FT_MulFix( glyphpath->font->outerTransform.b, pt.x ),
+               ADD_INT32(
+                 FT_MulFix( glyphpath->font->outerTransform.d, pt.y ),
+                 glyphpath->fractionalTranslation.y ) );
   }
 
 
@@ -1154,12 +1158,12 @@
     CF2_Fixed  denominator, s;
 
 
-    u.x = CF2_CS_SCALE( u2->x - u1->x );
-    u.y = CF2_CS_SCALE( u2->y - u1->y );
-    v.x = CF2_CS_SCALE( v2->x - v1->x );
-    v.y = CF2_CS_SCALE( v2->y - v1->y );
-    w.x = CF2_CS_SCALE( v1->x - u1->x );
-    w.y = CF2_CS_SCALE( v1->y - u1->y );
+    u.x = CF2_CS_SCALE( SUB_INT32( u2->x, u1->x ) );
+    u.y = CF2_CS_SCALE( SUB_INT32( u2->y, u1->y ) );
+    v.x = CF2_CS_SCALE( SUB_INT32( v2->x, v1->x ) );
+    v.y = CF2_CS_SCALE( SUB_INT32( v2->y, v1->y ) );
+    w.x = CF2_CS_SCALE( SUB_INT32( v1->x, u1->x ) );
+    w.y = CF2_CS_SCALE( SUB_INT32( v1->y, u1->y ) );
 
     denominator = cf2_perp( u, v );
 
@@ -1168,8 +1172,8 @@
 
     s = FT_DivFix( cf2_perp( w, v ), denominator );
 
-    intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x );
-    intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y );
+    intersection->x = ADD_INT32( u1->x, FT_MulFix( s, u2->x - u1->x ) );
+    intersection->y = ADD_INT32( u1->y, FT_MulFix( s, u2->y - u1->y ) );
 
     /*
      * Special case snapping for horizontal and vertical lines.
@@ -1181,23 +1185,23 @@
      */
 
     if ( u1->x == u2->x                                                     &&
-         cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold )
+         cf2_fixedAbs( SUB_INT32( intersection->x, u1->x ) ) < glyphpath->snapThreshold )
       intersection->x = u1->x;
     if ( u1->y == u2->y                                                     &&
-         cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold )
+         cf2_fixedAbs( SUB_INT32( intersection->y, u1->y ) ) < glyphpath->snapThreshold )
       intersection->y = u1->y;
 
     if ( v1->x == v2->x                                                     &&
-         cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold )
+         cf2_fixedAbs( SUB_INT32( intersection->x, v1->x ) ) < glyphpath->snapThreshold )
       intersection->x = v1->x;
     if ( v1->y == v2->y                                                     &&
-         cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold )
+         cf2_fixedAbs( SUB_INT32( intersection->y, v1->y ) ) < glyphpath->snapThreshold )
       intersection->y = v1->y;
 
     /* limit the intersection distance from midpoint of u2 and v1 */
-    if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) >
+    if ( cf2_fixedAbs( SUB_INT32( intersection->x, ADD_INT32( u2->x, v1->x ) / 2 ) ) >
            glyphpath->miterLimit                                   ||
-         cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) >
+         cf2_fixedAbs( SUB_INT32( intersection->y, ADD_INT32( u2->y, v1->y ) / 2 ) ) >
            glyphpath->miterLimit                                   )
       return FALSE;
 
@@ -1446,16 +1450,16 @@
                                CF2_Fixed*     x,
                                CF2_Fixed*     y )
   {
-    CF2_Fixed  dx = x2 - x1;
-    CF2_Fixed  dy = y2 - y1;
+    CF2_Fixed  dx = SUB_INT32( x2, x1 );
+    CF2_Fixed  dy = SUB_INT32( y2, y1 );
 
 
     /* note: negative offsets don't work here; negate deltas to change */
     /* quadrants, below                                                */
     if ( glyphpath->font->reverseWinding )
     {
-      dx = -dx;
-      dy = -dy;
+      dx = NEG_INT32( dx );
+      dy = NEG_INT32( dy );
     }
 
     *x = *y = 0;
@@ -1474,13 +1478,13 @@
       {
         /* first quadrant, +x +y */
 
-        if ( dx > 2 * dy )
+        if ( dx > MUL_INT32( 2, dy ) )
         {
           /* +x */
           *x = 0;
           *y = 0;
         }
-        else if ( dy > 2 * dx )
+        else if ( dy > MUL_INT32( 2, dx ) )
         {
           /* +y */
           *x = glyphpath->xOffset;
@@ -1499,16 +1503,16 @@
       {
         /* fourth quadrant, +x -y */
 
-        if ( dx > -2 * dy )
+        if ( dx > MUL_INT32( -2, dy ) )
         {
           /* +x */
           *x = 0;
           *y = 0;
         }
-        else if ( -dy > 2 * dx )
+        else if ( NEG_INT32( dy ) > MUL_INT32( 2, dx ) )
         {
           /* -y */
-          *x = -glyphpath->xOffset;
+          *x = NEG_INT32( glyphpath->xOffset );
           *y = glyphpath->yOffset;
         }
         else
@@ -1527,13 +1531,13 @@
       {
         /* second quadrant, -x +y */
 
-        if ( -dx > 2 * dy )
+        if ( NEG_INT32( dx ) > MUL_INT32( 2, dy ) )
         {
           /* -x */
           *x = 0;
-          *y = 2 * glyphpath->yOffset;
+          *y = MUL_INT32( 2, glyphpath->yOffset );
         }
-        else if ( dy > -2 * dx )
+        else if ( dy > MUL_INT32( -2, dx ) )
         {
           /* +y */
           *x = glyphpath->xOffset;
@@ -1552,16 +1556,16 @@
       {
         /* third quadrant, -x -y */
 
-        if ( -dx > -2 * dy )
+        if ( NEG_INT32( dx ) > MUL_INT32( -2, dy ) )
         {
           /* -x */
           *x = 0;
-          *y = 2 * glyphpath->yOffset;
+          *y = MUL_INT32( 2, glyphpath->yOffset );
         }
-        else if ( -dy > -2 * dx )
+        else if ( NEG_INT32( dy ) > MUL_INT32( -2, dx ) )
         {
           /* -y */
-          *x = -glyphpath->xOffset;
+          *x = NEG_INT32( glyphpath->xOffset );
           *y = glyphpath->yOffset;
         }
         else
@@ -1675,10 +1679,10 @@
                                  &yOffset );
 
     /* construct offset points */
-    P0.x = glyphpath->currentCS.x + xOffset;
-    P0.y = glyphpath->currentCS.y + yOffset;
-    P1.x = x + xOffset;
-    P1.y = y + yOffset;
+    P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset );
+    P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset );
+    P1.x = ADD_INT32( x, xOffset );
+    P1.y = ADD_INT32( y, yOffset );
 
     if ( glyphpath->moveIsPending )
     {
@@ -1757,15 +1761,15 @@
       cf2_getWindingMomentum( x1, y1, x2, y2 );
 
     /* construct offset points */
-    P0.x = glyphpath->currentCS.x + xOffset1;
-    P0.y = glyphpath->currentCS.y + yOffset1;
-    P1.x = x1 + xOffset1;
-    P1.y = y1 + yOffset1;
+    P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 );
+    P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset1 );
+    P1.x = ADD_INT32( x1, xOffset1 );
+    P1.y = ADD_INT32( y1, yOffset1 );
     /* note: preserve angle of final segment by using offset3 at both ends */
-    P2.x = x2 + xOffset3;
-    P2.y = y2 + yOffset3;
-    P3.x = x3 + xOffset3;
-    P3.y = y3 + yOffset3;
+    P2.x = ADD_INT32( x2, xOffset3 );
+    P2.y = ADD_INT32( y2, yOffset3 );
+    P3.x = ADD_INT32( x3, xOffset3 );
+    P3.y = ADD_INT32( y3, yOffset3 );
 
     if ( glyphpath->moveIsPending )
     {
--- freetype-2.6.3/src/cff/cf2intrp.c	2025-04-25 07:42:08.299753419 +0200
+++ freetype-2.6.3/src/cff/cf2intrp.c	2025-04-25 08:43:04.132960005 +0200
@@ -351,7 +351,7 @@
     {
       vals[i + 2] = vals[i];
       if ( readFromStack[i] )
-        vals[i + 2] += cf2_stack_getReal( opStack, index++ );
+        vals[i + 2] = ADD_INT32( vals[i + 2], cf2_stack_getReal( opStack, index++ ) );
     }
 
     if ( isHFlex )
@@ -359,31 +359,31 @@
 
     if ( doConditionalLastRead )
     {
-      FT_Bool    lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) >
-                                        cf2_fixedAbs( vals[11] - *curY ) );
+      FT_Bool    lastIsX = (FT_Bool)( cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) >
+                                        cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) );
       CF2_Fixed  lastVal = cf2_stack_getReal( opStack, index );
 
 
       if ( lastIsX )
       {
-        vals[12] = vals[10] + lastVal;
+        vals[12] = ADD_INT32( vals[10], lastVal );
         vals[13] = *curY;
       }
       else
       {
         vals[12] = *curX;
-        vals[13] = vals[11] + lastVal;
+        vals[13] = ADD_INT32( vals[11], lastVal );
       }
     }
     else
     {
       if ( readFromStack[10] )
-        vals[12] = vals[10] + cf2_stack_getReal( opStack, index++ );
+        vals[12] = ADD_INT32( vals[10], cf2_stack_getReal( opStack, index++ ) );
       else
         vals[12] = *curX;
 
       if ( readFromStack[11] )
-        vals[13] = vals[11] + cf2_stack_getReal( opStack, index );
+        vals[13] = ADD_INT32( vals[11], cf2_stack_getReal( opStack, index ) );
       else
         vals[13] = *curY;
     }
@@ -651,7 +651,7 @@
         if ( font->decoder->width_only )
           goto exit;
 
-        curY += cf2_stack_popFixed( opStack );
+        curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
 
         cf2_glyphpath_moveTo( &glyphPath, curX, curY );
 
@@ -667,8 +667,8 @@
 
           for ( index = 0; index < count; index += 2 )
           {
-            curX += cf2_stack_getReal( opStack, index + 0 );
-            curY += cf2_stack_getReal( opStack, index + 1 );
+            curX = ADD_INT32( curX, cf2_stack_getReal( opStack, index + 0 ) );
+            curY = ADD_INT32( curY, cf2_stack_getReal( opStack, index + 1 ) );
 
             cf2_glyphpath_lineTo( &glyphPath, curX, curY );
           }
@@ -694,9 +694,9 @@
 
 
             if ( isX )
-              curX += v;
+              curX = ADD_INT32( curX, v );
             else
-              curY += v;
+              curY = ADD_INT32( curY, v );
 
             isX = !isX;
 
@@ -719,12 +719,12 @@
 
           while ( index + 6 <= count )
           {
-            CF2_Fixed  x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
-            CF2_Fixed  y1 = cf2_stack_getReal( opStack, index + 1 ) + curY;
-            CF2_Fixed  x2 = cf2_stack_getReal( opStack, index + 2 ) + x1;
-            CF2_Fixed  y2 = cf2_stack_getReal( opStack, index + 3 ) + y1;
-            CF2_Fixed  x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
-            CF2_Fixed  y3 = cf2_stack_getReal( opStack, index + 5 ) + y2;
+            CF2_Fixed  x1 = ADD_INT32( cf2_stack_getReal( opStack, index + 0 ), curX );
+            CF2_Fixed  y1 = ADD_INT32( cf2_stack_getReal( opStack, index + 1 ), curY );
+            CF2_Fixed  x2 = ADD_INT32( cf2_stack_getReal( opStack, index + 2 ), x1 );
+            CF2_Fixed  y2 = ADD_INT32( cf2_stack_getReal( opStack, index + 3 ), y1 );
+            CF2_Fixed  x3 = ADD_INT32( cf2_stack_getReal( opStack, index + 4 ), x2 );
+            CF2_Fixed  y3 = ADD_INT32( cf2_stack_getReal( opStack, index + 5 ), y2 );
 
 
             cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@@ -736,8 +736,8 @@
 
           if ( op1 == cf2_cmdRCURVELINE )
           {
-            curX += cf2_stack_getReal( opStack, index + 0 );
-            curY += cf2_stack_getReal( opStack, index + 1 );
+            curX = ADD_INT32( curX, cf2_stack_getReal( opStack, index + 0 ) );
+            curY = ADD_INT32( curY, cf2_stack_getReal( opStack, index + 1 ) );
 
             cf2_glyphpath_lineTo( &glyphPath, curX, curY );
           }
@@ -888,6 +888,9 @@
 
               arg = cf2_stack_popFixed( opStack );
 
+                    if ( arg < -CF2_FIXED_MAX )
+                      cf2_stack_pushFixed( opStack, CF2_FIXED_MAX );
+                    else
               cf2_stack_pushFixed( opStack, FT_ABS( arg ) );
             }
             continue; /* do not clear the stack */
@@ -903,7 +906,9 @@
               summand2 = cf2_stack_popFixed( opStack );
               summand1 = cf2_stack_popFixed( opStack );
 
-              cf2_stack_pushFixed( opStack, summand1 + summand2 );
+                    cf2_stack_pushFixed( opStack,
+                                         ADD_INT32( summand1,
+                                                             summand2 ) );
             }
             continue; /* do not clear the stack */
 
@@ -918,7 +923,9 @@
               subtrahend = cf2_stack_popFixed( opStack );
               minuend    = cf2_stack_popFixed( opStack );
 
-              cf2_stack_pushFixed( opStack, minuend - subtrahend );
+                    cf2_stack_pushFixed( opStack,
+                                         SUB_INT32( minuend,
+                                                             subtrahend ) );
             }
             continue; /* do not clear the stack */
 
@@ -933,7 +940,8 @@
               divisor  = cf2_stack_popFixed( opStack );
               dividend = cf2_stack_popFixed( opStack );
 
-              cf2_stack_pushFixed( opStack, FT_DivFix( dividend, divisor ) );
+                    cf2_stack_pushFixed( opStack,
+                                         FT_DivFix( dividend, divisor ) );
             }
             continue; /* do not clear the stack */
 
@@ -946,6 +954,9 @@
 
               arg = cf2_stack_popFixed( opStack );
 
+                    if ( arg < -CF2_FIXED_MAX )
+                      cf2_stack_pushFixed( opStack, CF2_FIXED_MAX );
+                    else
               cf2_stack_pushFixed( opStack, -arg );
             }
             continue; /* do not clear the stack */
@@ -1016,7 +1027,8 @@
               arg2  = cf2_stack_popFixed( opStack );
               arg1  = cf2_stack_popFixed( opStack );
 
-              cf2_stack_pushFixed( opStack, cond1 <= cond2 ? arg1 : arg2 );
+                    cf2_stack_pushFixed( opStack,
+                                         cond1 <= cond2 ? arg1 : arg2 );
             }
             continue; /* do not clear the stack */
 
@@ -1037,7 +1049,8 @@
               factor2 = cf2_stack_popFixed( opStack );
               factor1 = cf2_stack_popFixed( opStack );
 
-              cf2_stack_pushFixed( opStack, FT_MulFix( factor1, factor2 ) );
+                    cf2_stack_pushFixed( opStack,
+                                         FT_MulFix( factor1, factor2 ) );
             }
             continue; /* do not clear the stack */
 
@@ -1051,7 +1064,9 @@
               arg = cf2_stack_popFixed( opStack );
               if ( arg > 0 )
               {
-                FT_Fixed  root = arg;
+                      /* use a start value that doesn't make */
+                      /* the algorithm's addition overflow   */
+                      FT_Fixed  root = arg < 10 ? arg : arg >> 1;
                 FT_Fixed  new_root;
 
 
@@ -1115,7 +1130,8 @@
 
               if ( size > 0 )
               {
-                /* for `cf2_stack_getReal', index 0 is bottom of stack */
+                      /* for `cf2_stack_getReal',   */
+                      /* index 0 is bottom of stack */
                 CF2_UInt  gr_idx;
 
 
@@ -1127,7 +1143,8 @@
                   gr_idx = size - 1 - (CF2_UInt)idx;
 
                 cf2_stack_pushFixed( opStack,
-                                     cf2_stack_getReal( opStack, gr_idx ) );
+                                           cf2_stack_getReal( opStack,
+                                                              gr_idx ) );
               }
             }
             continue; /* do not clear the stack */
@@ -1271,7 +1288,8 @@
              cf2_stack_count( opStack ) == 5 )
         {
           if ( !haveWidth )
-            *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
+            *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+                                         nominalWidthX );
         }
 
         /* width is defined or default after this */
@@ -1418,7 +1436,8 @@
         FT_TRACE4(( " rmoveto\n" ));
 
         if ( cf2_stack_count( opStack ) > 2 && !haveWidth )
-          *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
+          *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+                                       nominalWidthX );
 
         /* width is defined or default after this */
         haveWidth = TRUE;
@@ -1437,7 +1456,8 @@
         FT_TRACE4(( " hmoveto\n" ));
 
         if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
-          *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
+          *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+                                       nominalWidthX );
 
         /* width is defined or default after this */
         haveWidth = TRUE;
@@ -1445,7 +1465,7 @@
         if ( font->decoder->width_only )
           goto exit;
 
-        curX += cf2_stack_popFixed( opStack );
+        curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
 
         cf2_glyphpath_moveTo( &glyphPath, curX, curY );
 
@@ -1461,8 +1481,8 @@
 
           while ( index + 6 < count )
           {
-            curX += cf2_stack_getReal( opStack, index + 0 );
-            curY += cf2_stack_getReal( opStack, index + 1 );
+            curX = ADD_INT32( curX, cf2_stack_getReal( opStack, index + 0 ) );
+            curY = ADD_INT32( curY, cf2_stack_getReal( opStack, index + 1 ) );
 
             cf2_glyphpath_lineTo( &glyphPath, curX, curY );
             index += 2;
@@ -1470,12 +1490,12 @@
 
           while ( index < count )
           {
-            CF2_Fixed  x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
-            CF2_Fixed  y1 = cf2_stack_getReal( opStack, index + 1 ) + curY;
-            CF2_Fixed  x2 = cf2_stack_getReal( opStack, index + 2 ) + x1;
-            CF2_Fixed  y2 = cf2_stack_getReal( opStack, index + 3 ) + y1;
-            CF2_Fixed  x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
-            CF2_Fixed  y3 = cf2_stack_getReal( opStack, index + 5 ) + y2;
+            CF2_Fixed  x1 = ADD_INT32( cf2_stack_getReal( opStack, index + 0 ), curX );
+            CF2_Fixed  y1 = ADD_INT32( cf2_stack_getReal( opStack, index + 1 ), curY );
+            CF2_Fixed  x2 = ADD_INT32( cf2_stack_getReal( opStack, index + 2 ), x1 );
+            CF2_Fixed  y2 = ADD_INT32( cf2_stack_getReal( opStack, index + 3 ), y1 );
+            CF2_Fixed  x3 = ADD_INT32( cf2_stack_getReal( opStack, index + 4 ), x2 );
+            CF2_Fixed  y3 = ADD_INT32( cf2_stack_getReal( opStack, index + 5 ), y2 );
 
 
             cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@@ -1510,18 +1530,18 @@
 
             if ( ( count - index ) & 1 )
             {
-              x1 = cf2_stack_getReal( opStack, index ) + curX;
+              x1 = ADD_INT32( cf2_stack_getReal( opStack, index ), curX );
 
               ++index;
             }
             else
               x1 = curX;
 
-            y1 = cf2_stack_getReal( opStack, index + 0 ) + curY;
-            x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
-            y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
+            y1 = ADD_INT32( cf2_stack_getReal( opStack, index + 0 ), curY );
+            x2 = ADD_INT32( cf2_stack_getReal( opStack, index + 1 ), x1 );
+            y2 = ADD_INT32( cf2_stack_getReal( opStack, index + 2 ), y1 );
             x3 = x2;
-            y3 = cf2_stack_getReal( opStack, index + 3 ) + y2;
+            y3 = ADD_INT32( cf2_stack_getReal( opStack, index + 3 ), y2 );
 
             cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
 
@@ -1555,17 +1575,17 @@
 
             if ( ( count - index ) & 1 )
             {
-              y1 = cf2_stack_getReal( opStack, index ) + curY;
+              y1 = ADD_INT32( cf2_stack_getReal( opStack, index ), curY );
 
               ++index;
             }
             else
               y1 = curY;
 
-            x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
-            x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
-            y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
-            x3 = cf2_stack_getReal( opStack, index + 3 ) + x2;
+            x1 = ADD_INT32( cf2_stack_getReal( opStack, index + 0 ), curX );
+            x2 = ADD_INT32( cf2_stack_getReal( opStack, index + 1 ), x1 );
+            y2 = ADD_INT32( cf2_stack_getReal( opStack, index + 2 ), y1 );
+            x3 = ADD_INT32( cf2_stack_getReal( opStack, index + 3 ), x2 );
             y3 = y2;
 
             cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@@ -1604,15 +1624,15 @@
 
             if ( alternate )
             {
-              x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
+              x1 = ADD_INT32( cf2_stack_getReal( opStack, index + 0 ), curX );
               y1 = curY;
-              x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
-              y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
-              y3 = cf2_stack_getReal( opStack, index + 3 ) + y2;
+              x2 = ADD_INT32( cf2_stack_getReal( opStack, index + 1 ), x1 );
+              y2 = ADD_INT32( cf2_stack_getReal( opStack, index + 2 ), y1 );
+              y3 = ADD_INT32( cf2_stack_getReal( opStack, index + 3 ), y2 );
 
               if ( count - index == 5 )
               {
-                x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
+                x3 = ADD_INT32( cf2_stack_getReal( opStack, index + 4 ), x2 );
 
                 ++index;
               }
@@ -1624,14 +1644,14 @@
             else
             {
               x1 = curX;
-              y1 = cf2_stack_getReal( opStack, index + 0 ) + curY;
-              x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
-              y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
-              x3 = cf2_stack_getReal( opStack, index + 3 ) + x2;
+              y1 = ADD_INT32( cf2_stack_getReal( opStack, index + 0 ), curY );
+              x2 = ADD_INT32( cf2_stack_getReal( opStack, index + 1 ), x1 );
+              y2 = ADD_INT32( cf2_stack_getReal( opStack, index + 2 ), y1 );
+              x3 = ADD_INT32( cf2_stack_getReal( opStack, index + 3 ), x2 );
 
               if ( count - index == 5 )
               {
-                y3 = cf2_stack_getReal( opStack, index + 4 ) + y2;
+                y3 = ADD_INT32( cf2_stack_getReal( opStack, index + 4 ), y2 );
 
                 ++index;
               }
Only in freetype-2.6.3/src/cff: cf2intrp.c.rej
openSUSE Build Service is sponsored by