LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File cups-1.3.9-hpgltops2.patch of Package cups (Project DISCONTINUED:openSUSE:11.1)

--- cups-1.3.9/filter/hpgl-attr.c.orig	2008-10-09 22:12:03.000000000 +0200
+++ cups-1.3.9/filter/hpgl-attr.c	2008-11-25 16:40:42.000000000 +0100
@@ -214,7 +214,7 @@ NP_number_pens(int     num_params,	/* I
             "DEBUG: HP-GL/2 \'NP\' command with invalid number of "
 	    "parameters (%d)!\n", num_params);
 
-  for (i = 0; i <= PenCount; i ++)
+  for (i = 0; i < PenCount; i ++)
     Pens[i].width = PenWidth;
 
   PC_pen_color(0, NULL);
@@ -232,14 +232,14 @@ PC_pen_color(int     num_params,	/* I -
   int		i;			/* Looping var */
   static float	standard_colors[8][3] =	/* Standard colors for first 8 pens */
 		{
-		  { 1.0, 1.0, 1.0 },	/* White */
 		  { 0.0, 0.0, 0.0 },	/* Black */
 		  { 1.0, 0.0, 0.0 },	/* Red */
 		  { 0.0, 1.0, 0.0 },	/* Green */
 		  { 1.0, 1.0, 0.0 },	/* Yellow */
 		  { 0.0, 0.0, 1.0 },	/* Blue */
 		  { 1.0, 0.0, 1.0 },	/* Magenta */
-		  { 0.0, 1.0, 1.0 }	/* Cyan */
+		  { 0.0, 1.0, 1.0 },	/* Cyan */
+		  { 1.0, 1.0, 1.0 }	/* White */
 		};
 
 
--- cups-1.3.9/filter/hpgl-vector.c.orig	2008-07-12 00:48:49.000000000 +0200
+++ cups-1.3.9/filter/hpgl-vector.c	2008-11-25 16:40:42.000000000 +0100
@@ -393,13 +393,20 @@ PE_polyline_encoded(int     num_params,
           break;
       case ':' :	/* Select pen */
           s ++;
-          PenNumber = (int)decode_number(&s, base_bits, 1.0);
+          temp = (int)decode_number(&s, base_bits, 1.0) - 1;
+	  if (temp < 0 || temp >= PenCount)
+	  {
+	    fprintf(stderr, "DEBUG: Bad pen number %d in PE\n", temp + 1);
+	    return;
+	  }
+
+          PenNumber = temp;
 
 #ifdef DEBUG
-          fprintf(stderr, "DEBUG:     set pen #%d\n", PenNumber);
+          fprintf(stderr, "DEBUG:     set pen #%d\n", PenNumber + 1);
 #endif /* DEBUG */
 
-          Outputf("%% PE: set pen #%d\n", PenNumber);
+          Outputf("%% PE: set pen #%d\n", PenNumber + 1);
 
 	  if (PageDirty)
 	    printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0],