Merge pull request #1295 from rouault/fix_1293

opj_j2k_setup_encoder(): validate POC compno0 and compno1 (fixes #1293)
This commit is contained in:
Even Rouault 2020-12-02 10:05:39 +01:00 committed by GitHub
commit 18b1138fbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -7945,11 +7945,18 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
if (tileno + 1 == parameters->POC[i].tile) {
opj_poc_t *tcp_poc = &tcp->pocs[numpocs_tile];
if (parameters->POC[numpocs_tile].compno0 >= image->numcomps) {
opj_event_msg(p_manager, EVT_ERROR,
"Invalid compno0 for POC %d\n", i);
return OPJ_FALSE;
}
tcp_poc->resno0 = parameters->POC[numpocs_tile].resno0;
tcp_poc->compno0 = parameters->POC[numpocs_tile].compno0;
tcp_poc->layno1 = parameters->POC[numpocs_tile].layno1;
tcp_poc->resno1 = parameters->POC[numpocs_tile].resno1;
tcp_poc->compno1 = parameters->POC[numpocs_tile].compno1;
tcp_poc->compno1 = opj_uint_min(parameters->POC[numpocs_tile].compno1,
image->numcomps);
tcp_poc->prg1 = parameters->POC[numpocs_tile].prg1;
tcp_poc->tile = parameters->POC[numpocs_tile].tile;