Blame SOURCES/t1lib-5.1.2-type1-inv-rw-fix.patch

cd8116
diff -up t1lib-5.1.2/lib/type1/lines.c.orig t1lib-5.1.2/lib/type1/lines.c
cd8116
--- t1lib-5.1.2/lib/type1/lines.c.orig	2007-12-23 16:49:42.000000000 +0100
cd8116
+++ t1lib-5.1.2/lib/type1/lines.c	2012-01-10 00:50:01.617614468 +0100
cd8116
@@ -67,6 +67,10 @@ This module provides the following entry
cd8116
 None.
cd8116
 */
cd8116
  
cd8116
+#define  BITS         (sizeof(LONG)*8)
cd8116
+#define  HIGHTEST(p)  (((p)>>(BITS-2)) != 0)  /* includes sign bit */
cd8116
+#define  TOOBIG(xy)   ((xy < 0) ? HIGHTEST(-xy) : HIGHTEST(xy))
cd8116
+
cd8116
 /*
cd8116
 :h2.StepLine() - Produces Run Ends for a Line After Checks
cd8116
  
cd8116
@@ -84,6 +88,9 @@ void StepLine(R, x1, y1, x2, y2)
cd8116
        IfTrace4((LineDebug > 0), ".....StepLine: (%d,%d) to (%d,%d)\n",
cd8116
                                             x1, y1, x2, y2);
cd8116
  
cd8116
+      if ( TOOBIG(x1) || TOOBIG(x2) || TOOBIG(y1) || TOOBIG(y2))
cd8116
+              abort("Lines this big not supported", 49);
cd8116
+
cd8116
        dy = y2 - y1;
cd8116
  
cd8116
 /*
cd8116
diff -up t1lib-5.1.2/lib/type1/objects.c.orig t1lib-5.1.2/lib/type1/objects.c
cd8116
--- t1lib-5.1.2/lib/type1/objects.c.orig	2007-12-23 16:49:42.000000000 +0100
cd8116
+++ t1lib-5.1.2/lib/type1/objects.c	2012-01-10 00:55:18.082937510 +0100
cd8116
@@ -1137,12 +1137,13 @@ char *t1_get_abort_message( int number)
cd8116
     "Context:  out of them", /* 46 */
cd8116
     "MatrixInvert:  can't", /* 47 */
cd8116
     "xiStub called", /* 48 */
cd8116
-    "Illegal access type1 abort() message" /* 49 */
cd8116
+    "Lines this big not supported", /* 49 */
cd8116
+    "Illegal access type1 abort() message" /* 50 */
cd8116
   };
cd8116
 
cd8116
-  /* no is valid from 1 to 48 */
cd8116
-  if ( (number<1)||(number>48))
cd8116
-    number=49;
cd8116
+  /* no is valid from 1 to 49 */
cd8116
+  if ( (number<1)||(number>49))
cd8116
+    number=50;
cd8116
   return( err_msgs[number-1]);
cd8116
     
cd8116
 }
cd8116
diff -up t1lib-5.1.2/lib/type1/type1.c.orig t1lib-5.1.2/lib/type1/type1.c
cd8116
--- t1lib-5.1.2/lib/type1/type1.c.orig	2007-12-23 21:19:42.000000000 +0530
cd8116
+++ t1lib-5.1.2/lib/type1/type1.c	2012-01-04 13:11:50.324115578 +0530
cd8116
@@ -1012,6 +1012,7 @@ 
cd8116
   double nextdtana = 0.0;   /* tangent of post-delta against horizontal line */ 
cd8116
   double nextdtanb = 0.0;   /* tangent of post-delta against vertical line */ 
cd8116
   
cd8116
+  if (ppoints == NULL || numppoints < 1) Error0v("FindStems: No previous point!\n");
cd8116
  
cd8116
   /* setup default hinted position */
cd8116
   ppoints[numppoints-1].ax     = ppoints[numppoints-1].x;
cd8116
@@ -1289,7 +1290,7 @@ 
cd8116
 static int DoRead(CodeP)
cd8116
   int *CodeP;
cd8116
 {
cd8116
-  if (strindex >= CharStringP->len) return(FALSE); /* end of string */
cd8116
+  if (!CharStringP || strindex >= CharStringP->len) return(FALSE); /* end of string */
cd8116
   /* We handle the non-documented Adobe convention to use lenIV=-1 to
cd8116
      suppress charstring encryption. */
cd8116
   if (blues->lenIV==-1) {
cd8116
@@ -1700,6 +1701,7 @@ 
cd8116
   long pindex = 0;
cd8116
   
cd8116
   /* compute hinting for previous segment! */
cd8116
+  if (ppoints == NULL || numppoints < 2 ) Error0i("RLineTo: No previous point!\n");
cd8116
   FindStems( currx, curry, currx-ppoints[numppoints-2].x, curry-ppoints[numppoints-2].y, dx, dy);
cd8116
 
cd8116
   /* Allocate a new path point and pre-setup data */
cd8116
@@ -1728,6 +1730,7 @@ 
cd8116
   long pindex = 0;
cd8116
   
cd8116
   /* compute hinting for previous point! */
cd8116
+  if (ppoints == NULL || numppoints < 2) Error0i("RRCurveTo: No previous point!\n");
cd8116
   FindStems( currx, curry, currx-ppoints[numppoints-2].x, curry-ppoints[numppoints-2].y, dx1, dy1);
cd8116
 
cd8116
   /* Allocate three new path points and pre-setup data */
cd8116
@@ -1786,7 +1789,9 @@ 
cd8116
   long tmpind;
cd8116
   double deltax = 0.0;
cd8116
   double deltay = 0.0;
cd8116
-  
cd8116
+ 
cd8116
+  if (ppoints == NULL || numppoints < 1) Error0i("DoClosePath: No previous point!");
cd8116
+ 
cd8116
   /* If this ClosePath command together with the starting point of this
cd8116
      path completes to a segment aligned to a stem, we would miss
cd8116
      hinting for this point. --> Check and explicitly care for this! */
cd8116
@@ -1801,6 +1806,7 @@ 
cd8116
     deltax = ppoints[i].x - ppoints[numppoints-1].x;
cd8116
     deltay = ppoints[i].y - ppoints[numppoints-1].y;
cd8116
 
cd8116
+    if (ppoints == NULL || numppoints <= i + 1) Error0i("DoClosePath: No previous point!");
cd8116
     /* save nummppoints and reset to move point */
cd8116
     tmpind = numppoints;
cd8116
     numppoints = i + 1;
cd8116
@@ -1903,6 +1909,7 @@ 
cd8116
     FindStems( currx, curry, 0, 0, dx, dy);
cd8116
   }
cd8116
   else {
cd8116
+    if (ppoints == NULL || numppoints < 2) Error0i("RMoveTo: No previous point!\n");
cd8116
     FindStems( currx, curry, ppoints[numppoints-2].x, ppoints[numppoints-2].y, dx, dy);
cd8116
   }
cd8116
   
cd8116
@@ -2152,6 +2159,7 @@ 
cd8116
   DOUBLE cx, cy;
cd8116
   DOUBLE ex, ey;
cd8116
 
cd8116
+  if (ppoints == NULL || numppoints < 8) Error0v("FlxProc: No previous point!");
cd8116
 
cd8116
   /* Our PPOINT list now contains 7 moveto commands which
cd8116
      are about to be consumed by the Flex mechanism. --> Remove these
cd8116
@@ -2321,6 +2329,7 @@ 
cd8116
 /*   Returns currentpoint on stack          */
cd8116
 static void FlxProc2()
cd8116
 {
cd8116
+  if (ppoints == NULL || numppoints < 1) Error0v("FlxProc2: No previous point!");
cd8116
   /* Push CurrentPoint on fake PostScript stack */
cd8116
   PSFakePush( ppoints[numppoints-1].x);
cd8116
   PSFakePush( ppoints[numppoints-1].y);