Skip to content

Commit ef01f18

Browse files
authored
Cast to size_t before multiplication
Need to cast to size_t before multiplication otherwise overflow check is useless.
1 parent e078172 commit ef01f18

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/lib/openjp2/pi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,
12411241
l_current_pi->include = 00;
12421242
if (l_step_l <= (SIZE_MAX / (l_tcp->numlayers + 1U)))
12431243
{
1244-
l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));
1244+
l_current_pi->include = (OPJ_INT16*) opj_calloc((size_t)(l_tcp->numlayers + 1U) * l_step_l, sizeof(OPJ_INT16));
12451245
}
12461246

12471247
if

0 commit comments

Comments
 (0)