]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The sample Epson driver could crash (STR #4616)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 6 May 2015 20:28:22 +0000 (20:28 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 6 May 2015 20:28:22 +0000 (20:28 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12617 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-2.0.txt
filter/rastertoepson.c

index 3fa315d885efcf48d68d279fcd3ce215e177caef..0f58789f3f11a21ec324da71fe6ec57379196c26 100644 (file)
@@ -18,6 +18,7 @@ CHANGES IN CUPS V2.0.3
        - The cups-lpd mini-daemon did not check for request parameters
          (STR #4603)
        - The scheduler could get caught in a busy loop (STR #4605)
+       - The sample Epson driver could crash (STR #4616)
        - Added Russian translation (STR #4577)
 
 
index 7edd2097f297b0e92052b430c8ab67696dc21baa..b503795aef6cd09bfc170542e7d97bc07be9e3f0 100644 (file)
@@ -3,7 +3,7 @@
  *
  * EPSON ESC/P and ESC/P2 filter for CUPS.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
  * Copyright 1993-2007 by Easy Software Products.
  *
  * These coded instructions, statements, and computer programs are the
@@ -655,13 +655,19 @@ OutputLine(
         }
 
         for (width = header->cupsWidth, tempptr = CompBuffer;
-             width > 0;
+             width > 1;
              width -= 2, tempptr += 2, oddptr += DotBytes * 2,
                 evenptr += DotBytes * 2)
         {
           evenptr[0] = tempptr[0];
           oddptr[0]  = tempptr[1];
         }
+
+        if (width == 1)
+        {
+          evenptr[0] = tempptr[0];
+          oddptr[0]  = tempptr[1];
+        }
       }
       else
       {
@@ -873,6 +879,9 @@ OutputRows(
        putchar(0);
       }
 
+      if (dot_count & 1)
+        putchar(*ptr);
+
      /*
       * Move the head back and print the odd bytes...
       */
@@ -901,6 +910,9 @@ OutputRows(
        putchar(0);
         putchar(*ptr);
       }
+
+      if (dot_count & 1)
+        putchar(0);
     }
     else
       pwrite(dot_ptr, dot_count);