Encoder: avoid global buffer overflow on irreversible conversion when too many decomposition levels are specified (fixes #1286)

This commit is contained in:
Even Rouault 2020-11-30 22:37:07 +01:00
parent 2d119d03a0
commit 6daf5f3e1e
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D
1 changed files with 1 additions and 1 deletions

View File

@ -1976,7 +1976,7 @@ void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec)
if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) { if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
stepsize = 1.0; stepsize = 1.0;
} else { } else {
OPJ_FLOAT64 norm = opj_dwt_norms_real[orient][level]; OPJ_FLOAT64 norm = opj_dwt_getnorm_real(level, orient);
stepsize = (1 << (gain)) / norm; stepsize = (1 << (gain)) / norm;
} }
opj_dwt_encode_stepsize((OPJ_INT32) floor(stepsize * 8192.0), opj_dwt_encode_stepsize((OPJ_INT32) floor(stepsize * 8192.0),