Fix assertion in debug mode / heap-based buffer overflow in opj_write_bytes_LE for Cinema profiles with numresolutions = 1 (#985)
This commit is contained in:
parent
52d5690a6f
commit
4241ae6fbb
|
@ -6573,11 +6573,17 @@ static void opj_j2k_set_cinema_parameters(opj_cparameters_t *parameters,
|
||||||
|
|
||||||
/* Precincts */
|
/* Precincts */
|
||||||
parameters->csty |= 0x01;
|
parameters->csty |= 0x01;
|
||||||
|
if (parameters->numresolution == 1) {
|
||||||
|
parameters->res_spec = 1;
|
||||||
|
parameters->prcw_init[0] = 128;
|
||||||
|
parameters->prch_init[0] = 128;
|
||||||
|
} else {
|
||||||
parameters->res_spec = parameters->numresolution - 1;
|
parameters->res_spec = parameters->numresolution - 1;
|
||||||
for (i = 0; i < parameters->res_spec; i++) {
|
for (i = 0; i < parameters->res_spec; i++) {
|
||||||
parameters->prcw_init[i] = 256;
|
parameters->prcw_init[i] = 256;
|
||||||
parameters->prch_init[i] = 256;
|
parameters->prch_init[i] = 256;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* The progression order shall be CPRL */
|
/* The progression order shall be CPRL */
|
||||||
parameters->prog_order = OPJ_CPRL;
|
parameters->prog_order = OPJ_CPRL;
|
||||||
|
|
Loading…
Reference in New Issue