From: mike Date: Tue, 27 Mar 2001 15:45:20 +0000 (+0000) Subject: Fix a memory alignment bug in pstoraster that would cause a bus error X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8bf6feb3934cdab0eb163bc79546fe30f82fc08b;p=thirdparty%2Fcups.git Fix a memory alignment bug in pstoraster that would cause a bus error (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 --- diff --git a/CHANGES.txt b/CHANGES.txt index 507e580fba..8b90177d54 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/pstoraster/gdevprn.c b/pstoraster/gdevprn.c index ff47bcd87f..63718242a1 100644 --- a/pstoraster/gdevprn.c +++ b/pstoraster/gdevprn.c @@ -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. */ diff --git a/pstoraster/gxclist.c b/pstoraster/gxclist.c index d9899c53af..8e09b2afa0 100644 --- a/pstoraster/gxclist.c +++ b/pstoraster/gxclist.c @@ -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);