]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix a memory alignment bug in pstoraster that would cause a bus error
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 27 Mar 2001 15:45:20 +0000 (15:45 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 27 Mar 2001 15:45:20 +0000 (15:45 +0000)
(signal 10) with some printers, drivers, and options.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@1649 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
pstoraster/gdevprn.c
pstoraster/gxclist.c

index 507e580fba5fd56b1447ca70dd002885c01cdcde..8b90177d5419ce7ae781aea19b07e8bcd66fefdb 100644 (file)
@@ -120,6 +120,9 @@ CHANGES IN CUPS V1.1.7
        - Added support for /dev/lpa# parallel ports under *BSD.
        - Added META variables to the CGI header template to
          prevent caching of the results.
+       - Fixed an unaligned memory buffer for the pstoraster
+         clist states; this caused bus errors for some
+         combinations of printers, drivers, and options.
 
 
 CHANGES IN CUPS V1.1.6-3
index ff47bcd87f0a94d6aee9b844726dde1144d01f2c..63718242a1d879b7b8fa7be6bdf13765fd7a8672 100644 (file)
@@ -24,7 +24,7 @@
   GNU software to build or run it.
 */
 
-/*$Id: gdevprn.c,v 1.12 2001/03/16 20:42:06 mike Exp $ */
+/*$Id: gdevprn.c,v 1.13 2001/03/27 15:45:20 mike Exp $ */
 /* Generic printer driver support */
 #include "ctype_.h"
 #include "gdevprn.h"
@@ -573,7 +573,7 @@ gdev_prn_default_get_space_params(const gx_device_printer *printer_dev,
     switch (sscanf(cache_env, "%d%254s", &cache_size, cache_units))
     {
       case 0 :
-          cache_size = 32 * 1024 * 1024;
+          cache_size = 8 * 1024 * 1024;
          break;
       case 1 :
           cache_size *= 4 * TILE_SIZE * TILE_SIZE;
@@ -591,9 +591,10 @@ gdev_prn_default_get_space_params(const gx_device_printer *printer_dev,
     }
   }
   else
-    cache_size = 32 * 1024 * 1024;
+    cache_size = 8 * 1024 * 1024;
 
-  space_params->MaxBitmap = cache_size;
+  space_params->MaxBitmap   = cache_size;
+  space_params->BufferSpace = cache_size / 10;
 }
 
 /* Generic routine to send the page to the printer. */
index d9899c53afd929b96e59f0cabccc62c32b555f60..8e09b2afa0f2207527f34836600a917eace561e8 100644 (file)
@@ -24,7 +24,7 @@
   GNU software to build or run it.
 */
 
-/*$Id: gxclist.c,v 1.6 2001/01/22 15:03:55 mike Exp $ */
+/*$Id: gxclist.c,v 1.7 2001/03/27 15:45:20 mike Exp $ */
 /* Command list document- and page-level code. */
 #include "memory_.h"
 #include "string_.h"
@@ -239,6 +239,8 @@ clist_init_states(gx_device * dev, byte * init_data, uint data_size)
        &((gx_device_clist *)dev)->writer;
     ulong state_size = cdev->nbands * (ulong) sizeof(gx_clist_state);
 
+    fprintf(stderr, "DEBUG: init_data = %p for cdev->states!\n", init_data);
+
     /*
      * The +100 in the next line is bogus, but we don't know what the
      * real check should be. We're effectively assuring that at least 100
@@ -288,12 +290,16 @@ clist_init_data(gx_device * dev, byte * init_data, uint data_size)
        if (band_data_size >= band_space)
            return_error(gs_error_rangecheck);
        bits_size = min(band_space - band_data_size, data_size >> 1);
+       /**** MRS - make sure bits_size is 64-bit aligned for clist data!!! ****/
+       bits_size = (bits_size + 7) & ~7;
     } else {                   /*
                                 * Choose the largest band height that will fit in the
                                 * rendering-time buffer.
                                 */
        bits_size = clist_tile_cache_size(target, band_space);
        bits_size = min(bits_size, data_size >> 1);
+       /**** MRS - make sure bits_size is 64-bit aligned for clist data!!! ****/
+       bits_size = (bits_size + 7) & ~7;
        band_height = gdev_mem_max_height((gx_device_memory *) target,
                                          band_width,
                                          band_space - bits_size);