rpms/ghostscript/devel ghostscript-krgb.patch, NONE, 1.1 ghostscript.spec, 1.101, 1.102

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Mar 2 14:58:28 UTC 2006


Author: twaugh

Update of /cvs/dist/rpms/ghostscript/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv11215

Modified Files:
	ghostscript.spec 
Added Files:
	ghostscript-krgb.patch 
Log Message:
* Thu Mar  2 2006 Tim Waugh <twaugh at redhat.com>
- BuildRequires: gnutls-devel
- Updated KRGB patch for gdevijs.


ghostscript-krgb.patch:
 gdevijs.c |  134 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 113 insertions(+), 21 deletions(-)

--- NEW FILE ghostscript-krgb.patch ---
--- espgs-8.15.1/src/gdevijs.c.krgb	2006-03-02 13:39:15.000000000 +0000
+++ espgs-8.15.1/src/gdevijs.c	2006-03-02 13:39:20.000000000 +0000
@@ -28,27 +28,34 @@
  * You should use -dSAFER which sets .LockSafetyParams to true 
  * before opening this device.
  *
- * 11/26/03 David Suffield
+ * 11/26/03 David Suffield (gdevijs-krgb-1.0.patch)
  * (c) 2003-2004 Copyright Hewlett-Packard Development Company, LP
  *
  * 1. Removed hpijs 1.0-1.0.2 workarounds, use hpijs 1.0.3 or higher.
  * 2. Added krgb support.
  *
- * 02/21/05 David Suffield
+ * 02/21/05 David Suffield (gdevijs-krgb-1.1.patch)
  * 1. Fixed segfault issue with 1-bit color space.
  * 2. Fixed z-order issue with colored text on black rectangle.
  *
+ * 02/22/06 David Suffield (gdevijs-krgb-1.2.patch)
+ * 1. Fixed krgb buffer overflow issue with out-of-band data in fill_rectangle and copy_mono. 
+ *    This buffer overflow condition occurred with fullbleed print jobs that had k-band images.
+ * 2. Added Dan Coby (artifex) fix for gsijs_read_string_malloc gs_free *str memory leak.
+ *
  */
 
 #include "unistd_.h"	/* for dup() */
 #include <stdlib.h>
-#include <fcntl.h>
 #include "gdevprn.h"
 #include "gp.h"
 #include "ijs.h"
 #include "ijs_client.h"
 
 /*#define KRGB_DEBUG*/
+#ifdef KRGB_DEBUG
+#include <fcntl.h>
+#endif
 
 /* This should go into gdevprn.h, or, better yet, gdevprn should
    acquire an API for changing resolution. */
@@ -183,24 +190,62 @@
    if (ijsdev->krgb_mode && ijsdev->k_path && y >= 0 && x >= 0) 
    {
       int raster = (ijsdev->k_width+7) >> 3;
-      register unsigned char *dest=ijsdev->k_band+(raster*y)+(x >> 3);
-      int dest_start_bit = x & 7;
-      int i,j,w1;
+      register unsigned char *dest;
+      int dest_start_bit;
+      int band_height = ijsdev->k_band_size/raster;
+      int i,j,x1,y1,w1,h1;
 
       if (h <= 0 || w <= 0)
          return 0;
 
-      if ((x+w) > ijsdev->k_width)
-         w1 = ijsdev->k_width - x; 
+      /* Check for out-of-band graphic. */
+      if (x >= ijsdev->k_width || y >= band_height)
+         return 0;  /* out-of-band */
+
+      /* Check for x clipping. */
+      if (x < 0)
+      {
+         x1 = 0;
+         w1 = w + x;
+      }
+      else if ((x+w) > ijsdev->k_width)
+      {
+         x1 = x;
+         w1 = ijsdev->k_width - x;
+      }
       else
+      { 
+         x1 = x;
          w1 = w;
+      }
+
+      dest_start_bit = x1 & 7;
+
+      /* Check for y clipping. */
+      if (y < 0)
+      {
+         y1 = 0;
+         h1 = h + y;
+      }
+      else if ((y+h) > band_height)
+      {
+         y1 = y;
+         h1 = band_height - y;
+      }
+      else 
+      {
+         y1 = y;
+         h1 = h;
+      }
+
+      dest=ijsdev->k_band+(raster*y1)+(x1 >> 3);
 
       /* Note x,y orgin 0,0 is stored first byte 0 left to right. */
 
       if (color==0x0)
       { 
          /* Color is black, store in k plane band instead of regular band. */
-         for (j=0; j<h; j++)
+         for (j=0; j<h1; j++)
          {
             for (i=0; i<w1; i++)
                dest[(dest_start_bit+i)>>3] |= xmask[(dest_start_bit+i)&7];
@@ -211,7 +256,7 @@
       else
       {
          /* Color is not black, remove any k plane bits for z-order dependencies, store in regular band. */
-         for (j=0; j<h; j++)
+         for (j=0; j<h1; j++)
          {
             for (i=0; i<w1; i++)
                dest[(dest_start_bit+i)>>3] &= ~xmask[(dest_start_bit+i)&7];
@@ -229,26 +274,73 @@
 {
    gx_device_ijs *ijsdev = (gx_device_ijs *)((gx_device_forward *)dev)->target;
 
-   /*   if (ijsdev->krgb_mode && ijsdev->k_path && one==0x0) */
+   //   if (ijsdev->krgb_mode && ijsdev->k_path && one==0x0) 
    if (ijsdev->krgb_mode && ijsdev->k_path) 
    {
       /* Store in k plane band instead of regular band. */
       int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes, byte aligned */
-      register unsigned char *dest=ijsdev->k_band+(raster*y)+(x >> 3);
-      register const unsigned char *scan=data+(dx >> 3);
-      int dest_start_bit = x & 7;
-      int scan_start_bit = dx & 7;
-      int i, h=height;
+      register unsigned char *dest;
+      register const unsigned char *scan;
+      int dest_start_bit;
+      int scan_start_bit;
+      int band_height = ijsdev->k_band_size/raster;
+      int i,x1,y1,w1,h1,h=height;
       
       if (h <= 0 || w <= 0)
          return 0;
 
+      /* Check for out-of-band graphic. */
+      if (x >= ijsdev->k_width || y >= band_height)
+         return 0;  /* out-of-band */
+
+      /* Check for x clipping. */
+      if (x < 0)
+      {
+         x1 = 0;
+         w1 = w + x;
+         /* adj dx here?? */
+      }
+      else if ((x+w) > ijsdev->k_width)
+      {
+         x1 = x;
+         w1 = ijsdev->k_width - x;
+      }
+      else
+      { 
+         x1 = x;
+         w1 = w;
+      }
+
+      scan=data+(dx >> 3);
+      dest_start_bit = x1 & 7;
+      scan_start_bit = dx & 7;
+
+      /* Check for y clipping. */
+      if (y < 0)
+      {
+         y1 = 0;
+         h1 = h + y;
+         scan+=draster*(h-h1);
+      }
+      else if ((y+h) > band_height)
+      {
+         y1 = y;
+         h1 = band_height - y;
+      }
+      else 
+      {
+         y1 = y;
+         h1 = h;
+      }
+
+      dest=ijsdev->k_band+(raster*y1)+(x1 >> 3);
+
       if (one==0x0)
       {
          /* Color is black, store in k plane band instead of regular band. */
-         while (h-- > 0)
+         while (h1-- > 0)
          {
-            for (i=0; i<w; i++)
+            for (i=0; i<w1; i++)
             {
                if (scan[(scan_start_bit+i)>>3] & xmask[(scan_start_bit+i)&7])
                   dest[(dest_start_bit+i)>>3] |= xmask[(dest_start_bit+i)&7];
@@ -261,9 +353,9 @@
       else
       {
          /* Color is not black, remove any k plane bits for z-order dependencies, store in regular band. */
-         while (h-- > 0)
+         while (h1-- > 0)
          {
-            for (i=0; i<w; i++)
+            for (i=0; i<w1; i++)
             {
                if (scan[(scan_start_bit+i)>>3] & xmask[(scan_start_bit+i)&7])
                   dest[(dest_start_bit+i)>>3] &= ~xmask[(dest_start_bit+i)&7];
@@ -1131,7 +1223,7 @@
 	    }
 	    if (new_value.size >= *size) {
 	        if (*str)
-		    gs_free(str, *size, 1, "gsijs_read_string_malloc");
+		    gs_free(*str, *size, 1, "gsijs_read_string_malloc");
 		*str = NULL;
 		*size = 0;
 	    }


Index: ghostscript.spec
===================================================================
RCS file: /cvs/dist/rpms/ghostscript/devel/ghostscript.spec,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- ghostscript.spec	28 Feb 2006 13:29:52 -0000	1.101
+++ ghostscript.spec	2 Mar 2006 14:58:26 -0000	1.102
@@ -26,12 +26,13 @@
 Patch8: ghostscript-use-external-freetype.patch
 Patch9: ghostscript-split-font-configuration.patch
 Patch10: ghostscript-big-cmap-post.patch
+Patch11: ghostscript-krgb.patch
 
 Requires: zlib, libpng, glib2
 Requires: urw-fonts >= 1.1, ghostscript-fonts
 BuildRequires: libjpeg-devel, libXt-devel
 BuildRequires: zlib, zlib-devel, libpng, libpng-devel, unzip, gtk2-devel
-BuildRequires: glib2-devel
+BuildRequires: glib2-devel, gnutls-devel
 # Omni requires libxml
 BuildRequires: libxml2-devel
 BuildRequires: libtiff-devel
@@ -106,6 +107,9 @@
 # Support reading a big cmap/post table from a TrueType font.
 %patch10 -p1 -b .big-cmap-post
 
+# Updated KRGB patch for gdevijs.
+%patch11 -p1 -b .krgb
+
 # Convert manual pages to UTF-8
 from8859_1() {
 	iconv -f iso-8859-1 -t utf-8 < "$1" > "${1}_"
@@ -263,6 +267,10 @@
 %postun -p /sbin/ldconfig
 
 %changelog
+* Thu Mar  2 2006 Tim Waugh <twaugh at redhat.com>
+- BuildRequires: gnutls-devel
+- Updated KRGB patch for gdevijs.
+
 * Tue Feb 28 2006 Karsten Hopp <karsten at redhat.de> 8.15.1-6
 - BuildRequires: libXt-devel
 




More information about the fedora-cvs-commits mailing list