Skip to content

Commit

Permalink
Merge pull request #1491 from headshog/fix-j2k-header
Browse files Browse the repository at this point in the history
Integer Overflow at j2k.c:11114
  • Loading branch information
rouault authored Dec 8, 2023
2 parents 03afd06 + 67e6a79 commit 00e0bdc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/openjp2/j2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -11101,6 +11101,10 @@ static OPJ_BOOL opj_j2k_read_SQcd_SQcc(opj_j2k_t *p_j2k,
l_tccp->stepsizes[l_band_no].mant = 0;
}
}

if (*p_header_size < l_num_band) {
return OPJ_FALSE;
}
*p_header_size = *p_header_size - l_num_band;
} else {
for (l_band_no = 0; l_band_no < l_num_band; l_band_no++) {
Expand All @@ -11111,6 +11115,10 @@ static OPJ_BOOL opj_j2k_read_SQcd_SQcc(opj_j2k_t *p_j2k,
l_tccp->stepsizes[l_band_no].mant = l_tmp & 0x7ff;
}
}

if (*p_header_size < 2 * l_num_band) {
return OPJ_FALSE;
}
*p_header_size = *p_header_size - 2 * l_num_band;
}

Expand Down

0 comments on commit 00e0bdc

Please sign in to comment.