We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ea320da commit c16bc05Copy full SHA for c16bc05
src/lib/openjp2/pi.c
@@ -1237,7 +1237,13 @@ opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,
1237
l_current_pi = l_pi;
1238
1239
/* memory allocation for include */
1240
- l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));
+ /* prevent an integer overflow issue */
1241
+ l_current_pi->include = 00;
1242
+ if (l_step_l <= (SIZE_MAX / (l_tcp->numlayers + 1U)))
1243
+ {
1244
+ l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));
1245
+ }
1246
+
1247
if
1248
(!l_current_pi->include)
1249
{
0 commit comments