From: setharnold Date: Thu, 15 Feb 2018 01:46:38 +0000 (-0800) Subject: fix unchecked integer multiplication overflow X-Git-Tag: v2.3.1~40^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24d08ff94ad8b0f51534e46f87cf5a2f2f85d22a;p=openjpeg fix unchecked integer multiplication overflow Hello, this fixes an unchecked integer multiplication overflow. Thanks. --- diff --git a/src/lib/openjp2/image.c b/src/lib/openjp2/image.c index 13bcb8e4..fe373905 100644 --- a/src/lib/openjp2/image.c +++ b/src/lib/openjp2/image.c @@ -48,8 +48,8 @@ opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, image->color_space = clrspc; image->numcomps = numcmpts; /* allocate memory for the per-component information */ - image->comps = (opj_image_comp_t*)opj_calloc(1, - image->numcomps * sizeof(opj_image_comp_t)); + image->comps = (opj_image_comp_t*)opj_calloc(image->numcomps, + sizeof(opj_image_comp_t)); if (!image->comps) { /* TODO replace with event manager, breaks API */ /* fprintf(stderr,"Unable to allocate memory for image.\n"); */