summaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2023-03-10 15:19:27 +0000
committerRobin Watts <Robin.Watts@artifex.com>2023-03-10 16:30:11 +0000
commit42c0918f239775be2b1774eb89fadb1577b5df6e (patch)
treea015cb4bb4a4ef4dd9b4fe89ee51a6c2c7291d09 /devices
parent85c0ca2f1ada534f831b43d4872a29eb4e787a28 (diff)
downloadghostpdl-42c0918f239775be2b1774eb89fadb1577b5df6e.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.
Diffstat (limited to 'devices')
-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);