Revised iterator type in jp2.c, added cast to to memory allocation to prevent possible overflow before call in j2k.c.

This commit is contained in:
Eharve14 2022-01-18 15:02:41 -05:00
parent cc635ec3e5
commit 8f5d7dd9c5
2 changed files with 4 additions and 4 deletions

View File

@ -1677,7 +1677,7 @@ static OPJ_BOOL opj_j2k_check_poc_val(const opj_poc_t *p_pocs,
assert(p_nb_pocs > 0);
packet_array = (OPJ_UINT32*) opj_calloc(step_l * p_num_layers,
packet_array = (OPJ_UINT32*) opj_calloc((size_t)step_l * p_num_layers,
sizeof(OPJ_UINT32));
if (packet_array == 00) {
opj_event_msg(p_manager, EVT_ERROR,

View File

@ -1136,9 +1136,9 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image,
}
max = image->numcomps;
for (i = 0; i < max; ++i) {
if (old_comps[i].data) {
opj_image_data_free(old_comps[i].data);
for (j = 0; j < max; ++j) {
if (old_comps[j].data) {
opj_image_data_free(old_comps[j].data);
}
}