diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2019-07-17 10:25:45 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2019-07-17 10:25:45 -0700 |
commit | c0e588f679fca92d92045049fd60846b57da899c (patch) | |
tree | c73e7cebf660b384328f731c2101e4800a0f1a56 /base/gxpcmap.c | |
parent | c7499c426c0307880e9a34a577492d99a976c15b (diff) | |
download | ghostpdl-c0e588f679fca92d92045049fd60846b57da899c.tar.gz |
Fix crash when RAW_PATTERN_DUMP is enabled
RAW_PATTERN_DUMP is used to help debug pattern issues.
Crash introduced when changes were made to file i/o.
Easy to overlook since this is rarely enabled.
Diffstat (limited to 'base/gxpcmap.c')
-rw-r--r-- | base/gxpcmap.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/base/gxpcmap.c b/base/gxpcmap.c index a05bab499..ea81fb003 100644 --- a/base/gxpcmap.c +++ b/base/gxpcmap.c @@ -1022,7 +1022,7 @@ gx_pattern_cache_update_used(gs_gstate *pgs, ulong used) * device, but it may zero out the bitmap_memory pointers to prevent * the accumulated bitmaps from being freed when the device is closed. */ -static void make_bitmap(gx_strip_bitmap *, const gx_device_memory *, gx_bitmap_id); +static void make_bitmap(gx_strip_bitmap *, const gx_device_memory *, gx_bitmap_id, const gs_memory_t *); int gx_pattern_cache_add_entry(gs_gstate * pgs, gx_device_forward * fdev, gx_color_tile ** pctile) @@ -1139,12 +1139,12 @@ gx_pattern_cache_add_entry(gs_gstate * pgs, ctile->blending_mode = 0; if (dev_proc(fdev, open_device) != pattern_clist_open_device) { if (mbits != 0) { - make_bitmap(&ctile->tbits, mbits, gs_next_ids(pgs->memory, 1)); + make_bitmap(&ctile->tbits, mbits, gs_next_ids(pgs->memory, 1), pgs->memory); mbits->bitmap_memory = 0; /* don't free the bits */ } else ctile->tbits.data = 0; if (mmask != 0) { - make_bitmap(&ctile->tmask, mmask, id); + make_bitmap(&ctile->tmask, mmask, id, pgs->memory); mmask->bitmap_memory = 0; /* don't free the bits */ } else ctile->tmask.data = 0; @@ -1247,7 +1247,8 @@ gx_pattern_cache_add_dummy_entry(gs_gstate *pgs, file name */ static void dump_raw_pattern(int height, int width, int n_chan, int depth, - byte *Buffer, int raster, const gx_device_memory * mdev) + byte *Buffer, int raster, const gx_device_memory * mdev, + const gs_memory_t *memory) { char full_file_name[50]; gp_file *fid; @@ -1269,7 +1270,7 @@ dump_raw_pattern(int height, int width, int n_chan, int depth, gs_sprintf(full_file_name, "%d)PATTERN_CHUNK_%dx%dx%d.raw", global_pat_index, width, height, max_bands); } - fid = gp_fopen(mdev,full_file_name,"wb"); + fid = gp_fopen(memory,full_file_name,"wb"); if (depth >= 8) { /* Contone data. */ if (is_planar) { @@ -1328,7 +1329,7 @@ dump_raw_pattern(int height, int width, int n_chan, int depth, static void make_bitmap(register gx_strip_bitmap * pbm, const gx_device_memory * mdev, - gx_bitmap_id id) + gx_bitmap_id id, const gs_memory_t *memory) { pbm->data = mdev->base; pbm->raster = mdev->raster; @@ -1345,7 +1346,7 @@ make_bitmap(register gx_strip_bitmap * pbm, const gx_device_memory * mdev, mdev->color_info.num_components, mdev->color_info.depth, (unsigned char*) mdev->base, - pbm->raster, mdev); + pbm->raster, mdev, memory); global_pat_index++; |