~ubuntu-branches/ubuntu/jaunty/cups/jaunty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/hpgl-regression.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2008-12-01 17:33:18 UTC
  • mfrom: (7.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081201173318-9tpgqzvxaosjnvsv
Tags: 1.3.8-1lenny4
* High urgency due to security bug fix.
* Add png-image-int-overflow.dpatch: Fix integer overflow in the PNG image
  reader (Closes: #507183, STR #2974, CVE-2008-5286)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
2
## hpgl-regression.dpatch by Martin Pitt <mpitt@debian.org>
3
3
##
4
 
## DP: Revert the SP_select_pen() enumeration change introduced in STR #2911,
5
 
## DP: because it changes the color mapping (e. g. "SP1" would now select a
6
 
## DP: white pen instead of a black one, and "SP0" would not be valid at all
7
 
## DP: any more). Also fix a remaining off-by-one loop. (STR #2966)
 
4
## DP: Fix HPGL pen selection regression introduced in STR #2911.
 
5
## DP: Also fix a remaining off-by-one loop. (STR #2966)
8
6
@DPATCH@
9
7
diff -urNad trunk~/filter/hpgl-attr.c trunk/filter/hpgl-attr.c
10
8
--- trunk~/filter/hpgl-attr.c   2008-10-09 22:12:03.000000000 +0200
11
 
+++ trunk/filter/hpgl-attr.c    2008-10-10 10:55:46.000000000 +0200
 
9
+++ trunk/filter/hpgl-attr.c    2008-11-13 11:26:46.000000000 +0100
 
10
@@ -3,7 +3,7 @@
 
11
  *
 
12
  *   HP-GL/2 attribute processing for the Common UNIX Printing System (CUPS).
 
13
  *
 
14
- *   Copyright 2007 by Apple Inc.
 
15
+ *   Copyright 2007-2008 by Apple Inc.
 
16
  *   Copyright 1993-2007 by Easy Software Products.
 
17
  *
 
18
  *   These coded instructions, statements, and computer programs are the
12
19
@@ -214,7 +214,7 @@
13
20
             "DEBUG: HP-GL/2 \'NP\' command with invalid number of "
14
21
            "parameters (%d)!\n", num_params);
18
25
     Pens[i].width = PenWidth;
19
26
 
20
27
   PC_pen_color(0, NULL);
21
 
@@ -433,7 +433,7 @@
22
 
     fprintf(stderr, "DEBUG: HP-GL/2 \'SP\' command with invalid pen (%d)!\n",
23
 
            (int)params[0].value.number);
24
 
   else
25
 
-    PenNumber = (int)params[0].value.number - 1;
26
 
+    PenNumber = (int)params[0].value.number;
27
 
 
28
 
   if (PageDirty)
29
 
     printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0],
 
28
@@ -232,14 +232,14 @@
 
29
   int          i;                      /* Looping var */
 
30
   static float standard_colors[8][3] = /* Standard colors for first 8 pens */
 
31
                {
 
32
-                 { 1.0, 1.0, 1.0 },    /* White */
 
33
                  { 0.0, 0.0, 0.0 },    /* Black */
 
34
                  { 1.0, 0.0, 0.0 },    /* Red */
 
35
                  { 0.0, 1.0, 0.0 },    /* Green */
 
36
                  { 1.0, 1.0, 0.0 },    /* Yellow */
 
37
                  { 0.0, 0.0, 1.0 },    /* Blue */
 
38
                  { 1.0, 0.0, 1.0 },    /* Magenta */
 
39
-                 { 0.0, 1.0, 1.0 }     /* Cyan */
 
40
+                 { 0.0, 1.0, 1.0 },    /* Cyan */
 
41
+                 { 1.0, 1.0, 1.0 }     /* White */
 
42
                };
 
43
 
 
44
 
 
45
diff -urNad trunk~/filter/hpgl-vector.c trunk/filter/hpgl-vector.c
 
46
--- trunk~/filter/hpgl-vector.c 2008-07-12 00:48:49.000000000 +0200
 
47
+++ trunk/filter/hpgl-vector.c  2008-11-13 11:26:03.000000000 +0100
 
48
@@ -3,7 +3,7 @@
 
49
  *
 
50
  *   HP-GL/2 vector routines for the Common UNIX Printing System (CUPS).
 
51
  *
 
52
- *   Copyright 2007 by Apple Inc.
 
53
+ *   Copyright 2007-2008 by Apple Inc.
 
54
  *   Copyright 1993-2007 by Easy Software Products.
 
55
  *
 
56
  *   These coded instructions, statements, and computer programs are the
 
57
@@ -393,13 +393,20 @@
 
58
           break;
 
59
       case ':' :       /* Select pen */
 
60
           s ++;
 
61
-          PenNumber = (int)decode_number(&s, base_bits, 1.0);
 
62
+          temp = (int)decode_number(&s, base_bits, 1.0) - 1;
 
63
+         if (temp < 0 || temp >= PenCount)
 
64
+         {
 
65
+           fprintf(stderr, "DEBUG: Bad pen number %d in PE\n", temp + 1);
 
66
+           return;
 
67
+         }
 
68
+
 
69
+          PenNumber = temp;
 
70
 
 
71
 #ifdef DEBUG
 
72
-          fprintf(stderr, "DEBUG:     set pen #%d\n", PenNumber);
 
73
+          fprintf(stderr, "DEBUG:     set pen #%d\n", PenNumber + 1);
 
74
 #endif /* DEBUG */
 
75
 
 
76
-          Outputf("%% PE: set pen #%d\n", PenNumber);
 
77
+          Outputf("%% PE: set pen #%d\n", PenNumber + 1);
 
78
 
 
79
          if (PageDirty)
 
80
            printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0],