summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2023-03-10 15:19:27 +0000
committerChris Liddell <chris.liddell@artifex.com>2023-03-13 09:08:11 +0000
commite14dc88ae485455e2aefea9bed96aad33e55be76 (patch)
tree88dcdacca5a602a4d78218757757cd12f25e7c90
parent8628f1a294e9c74856885dbd2d2a4f23a94b4202 (diff)
downloadghostpdl-e14dc88ae485455e2aefea9bed96aad33e55be76.tar.gz
Bug 706351 (maybe): Fix error seen when testing display dev in api_test
Chunky separations were SEGVing due to a the device proc for fill_rectangle_hl_color not being setup. Planar separations were buffer overflowing due to a short allocation for the bitmap due to unknown number of separations.
-rw-r--r--devices/gdevdsp.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/devices/gdevdsp.c b/devices/gdevdsp.c
index e279d5874..217d9c8ac 100644
--- a/devices/gdevdsp.c
+++ b/devices/gdevdsp.c
@@ -1843,6 +1843,9 @@ display_set_separations(gx_device_display *dev)
unsigned int c, m, y, k;
gx_device_display *head = dev;
+ if (num_comp > GX_DEVICE_COLOR_MAX_COMPONENTS)
+ num_comp = GX_DEVICE_COLOR_MAX_COMPONENTS;
+
while(head->parent)
head = (gx_device_display *)head->parent;
@@ -2218,11 +2221,16 @@ display_set_color_format(gx_device_display *ddev, int nFormat)
return_error(gs_error_rangecheck);
if (ddev->is_planar)
{
- int n = ddev->devn_params.num_std_colorant_names + ddev->devn_params.separations.num_separations;
- if (n == 0)
- n = GS_CLIENT_COLOR_MAX_COMPONENTS;
- if (n > GS_CLIENT_COLOR_MAX_COMPONENTS)
+ int n;
+ if (ddev->devn_params.separations.num_separations == 0)
n = GS_CLIENT_COLOR_MAX_COMPONENTS;
+ else {
+ n = ddev->devn_params.num_std_colorant_names + ddev->devn_params.separations.num_separations;
+ if (n == 0)
+ n = GS_CLIENT_COLOR_MAX_COMPONENTS;
+ if (n > GS_CLIENT_COLOR_MAX_COMPONENTS)
+ n = GS_CLIENT_COLOR_MAX_COMPONENTS;
+ }
bpp = n * 8;
set_color_info(&dci, DISPLAY_MODEL_SEP, n, GS_CLIENT_COLOR_MAX_COMPONENTS, bpp,
maxvalue, maxvalue);