diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2017-09-11 09:30:59 -0700 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2017-09-11 10:31:59 -0700 |
commit | a1cd439519aa07b5f70b1b044342d90377c1188e (patch) | |
tree | 1a54f31f6d3fd1071a603b7a10734a1a500b5f57 | |
parent | 9e92e379d04979de614bbdb89a0af5f4aff187cb (diff) | |
download | ghostpdl-a1cd439519aa07b5f70b1b044342d90377c1188e.tar.gz |
Coverity ID 94477 and 158386
94477 suggests a potential access (as an array pcc[i]) past the singelton
address which could occur if pgs->color_component_map.num_components > 1
Copy the "all" value to an array to prevent the issue.
158386 was a mistake, fixed. Two differences show up with bitrgbtags, but
they look the same to me.
tests_private/comparefiles/Altona_Technical_v20_x4.pdf
tests_private/comparefiles/eci_altona-test-suite-v2_technical2_x4.pdf
-rw-r--r-- | base/gdevp14.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/base/gdevp14.c b/base/gdevp14.c index f0850de49..58ec95565 100644 --- a/base/gdevp14.c +++ b/base/gdevp14.c @@ -4732,7 +4732,7 @@ pdf14_update_device_color_procs_push_c(gx_device *dev, memset(&(pdev->color_info.comp_shift),0,GX_DEVICE_COLOR_MAX_COMPONENTS); memcpy(&(pdev->color_info.comp_bits), comp_bits, new_num_comps); memcpy(&(pdev->color_info.comp_shift), comp_shift, new_num_comps); - pdev->color_info.comp_shift[new_num_comps] = 1 << (new_depth - 8); /* in case we has_tags is set */ + pdev->color_info.comp_shift[new_num_comps] = new_depth - 8; /* in case we has_tags is set */ /* If we have a compressed color codec, and we are doing a soft mask push operation then go ahead and update the color encode and @@ -5728,12 +5728,13 @@ pdf14_cmap_separation_direct(frac all, gx_device_color * pdc, const gs_gstate * int i, ncomps = dev->color_info.num_components; int num_spots = pdf14_get_num_spots(dev); bool additive = dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE; - frac comp_value = all; frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS]; gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS]; gx_color_index color; if (pgs->color_component_map.sep_type == SEP_ALL) { + frac comp_value = all; + /* * Invert the photometric interpretation for additive * color spaces because separations are always subtractive. @@ -5745,8 +5746,12 @@ pdf14_cmap_separation_direct(frac all, gx_device_color * pdc, const gs_gstate * for (; i >= 0; i--) cm_comps[i] = comp_value; } else { + frac comp_value[GX_DEVICE_COLOR_MAX_COMPONENTS]; + /* map to the color model */ - map_components_to_colorants(&comp_value, &(pgs->color_component_map), cm_comps); + for (i = pgs->color_component_map.num_components - 1; i >= 0; i--) + comp_value[i] = all; + map_components_to_colorants(comp_value, &(pgs->color_component_map), cm_comps); } /* apply the transfer function(s); convert to color values */ if (additive) { |