summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2020-05-11 00:57:18 +0100
committerRobin Watts <Robin.Watts@artifex.com>2020-05-11 10:40:55 +0100
commit4f03b3f51957fcaab6b953ba79bb32d2096ad49b (patch)
tree486300e61f7c71d5fbaafe8f6d26a85e402445e1 /xps
parent4c305cb14b76bebfe0e147bcd90f4cc2ec7482ac (diff)
downloadghostpdl-4f03b3f51957fcaab6b953ba79bb32d2096ad49b.tar.gz
lgtm.com fixes: Avoid narrow mult cast to longer type.
Avoid masking overflows through relying on implicit casting.
Diffstat (limited to 'xps')
-rw-r--r--xps/xpstiff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xps/xpstiff.c b/xps/xpstiff.c
index ce35627c9..cd57fdb65 100644
--- a/xps/xpstiff.c
+++ b/xps/xpstiff.c
@@ -573,7 +573,7 @@ xps_expand_colormap(xps_context_t *ctx, xps_tiff_t *tiff, xps_image_t *image)
stride = image->width * (image->comps + 2);
- samples = xps_alloc(ctx, stride * image->height);
+ samples = xps_alloc(ctx, (size_t)stride * image->height);
if (!samples)
return gs_throw(gs_error_VMerror, "out of memory: samples");
@@ -694,11 +694,11 @@ xps_decode_tiff_strips(xps_context_t *ctx, xps_tiff_t *tiff, xps_image_t *image)
image->yres = 96;
}
- image->samples = xps_alloc(ctx, image->stride * image->height);
+ image->samples = xps_alloc(ctx, (size_t)image->stride * image->height);
if (!image->samples)
return gs_throw(gs_error_VMerror, "could not allocate image samples");
- memset(image->samples, 0x55, image->stride * image->height);
+ memset(image->samples, 0x55, (size_t)image->stride * image->height);
wp = image->samples;