summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2020-05-15 11:48:07 +0100
committerRobin Watts <Robin.Watts@artifex.com>2020-05-15 11:49:33 +0100
commit2f768243df42031a3f37f256678e34c1ac97fdde (patch)
treef7ba9563a9f78828a319d497d821c88675ce9e06 /xps
parentb380ebb41878645d0d7bb2b07155667acac4fa99 (diff)
downloadghostpdl-2f768243df42031a3f37f256678e34c1ac97fdde.tar.gz
lgtm.com fixes: Multiplication of narrow type in wider context.
Diffstat (limited to 'xps')
-rw-r--r--xps/xpsimage.c4
-rw-r--r--xps/xpsjxr.c4
-rw-r--r--xps/xpspng.c2
-rw-r--r--xps/xpszip.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/xps/xpsimage.c b/xps/xpsimage.c
index f2b5b36d3..aedcbdd68 100644
--- a/xps/xpsimage.c
+++ b/xps/xpsimage.c
@@ -34,7 +34,7 @@ xps_isolate_alpha_channel_8(xps_context_t *ctx, xps_image_t *image)
int y, x, k;
byte *sp, *dp, *ap;
- image->alpha = xps_alloc(ctx, image->width * image->height);
+ image->alpha = xps_alloc(ctx, (size_t)image->width * image->height);
if (!image->alpha) {
gs_throw(gs_error_VMerror, "out of memory: image->alpha.\n");
return;
@@ -65,7 +65,7 @@ xps_isolate_alpha_channel_16(xps_context_t *ctx, xps_image_t *image)
int y, x, k;
unsigned short *sp, *dp, *ap;
- image->alpha = xps_alloc(ctx, image->width * image->height * 2);
+ image->alpha = xps_alloc(ctx, (size_t)image->width * image->height * 2);
if (!image->alpha) {
gs_throw(gs_error_VMerror, "out of memory: image->alpha.\n");
return;
diff --git a/xps/xpsjxr.c b/xps/xpsjxr.c
index 3f9088ca6..68fb6415e 100644
--- a/xps/xpsjxr.c
+++ b/xps/xpsjxr.c
@@ -98,7 +98,7 @@ xps_decode_jpegxr_block(jxr_image_t image, int mx, int my, int *data)
output->hasalpha = jxr_get_ALPHACHANNEL_FLAG(image);
output->bits = 8;
output->stride = output->width * output->comps;
- output->samples = xps_alloc(ctx, output->stride * output->height);
+ output->samples = xps_alloc(ctx, (size_t)output->stride * output->height);
if (!output->samples) {
gs_throw(gs_error_VMerror, "out of memory: output->samples.\n");
return;
@@ -149,7 +149,7 @@ xps_decode_jpegxr_alpha_block(jxr_image_t image, int mx, int my, int *data)
if (!output->alpha)
{
- output->alpha = xps_alloc(ctx, output->width * output->height);
+ output->alpha = xps_alloc(ctx, (size_t)output->width * output->height);
if (!output->alpha) {
gs_throw(gs_error_VMerror, "out of memory: output->alpha.\n");
return;
diff --git a/xps/xpspng.c b/xps/xpspng.c
index 59f802c62..24d053c09 100644
--- a/xps/xpspng.c
+++ b/xps/xpspng.c
@@ -311,7 +311,7 @@ xps_decode_png(xps_context_t *ctx, byte *rbuf, int rlen, xps_image_t *image)
image->stride = (image->width * image->comps * image->bits + 7) / 8;
- 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, "out of memory.\n");
}
diff --git a/xps/xpszip.c b/xps/xpszip.c
index d030225e5..1c3843567 100644
--- a/xps/xpszip.c
+++ b/xps/xpszip.c
@@ -48,7 +48,7 @@ static inline int getlong(gp_file *file)
static void *
xps_zip_alloc_items(xps_context_t *ctx, int items, int size)
{
- void *item = xps_alloc(ctx, items * size);
+ void *item = xps_alloc(ctx, (size_t)items * size);
if (!item) {
gs_throw(gs_error_VMerror, "out of memory: item.\n");
return NULL;