opj_t1_encode_cblk(): avoid uint32 overflow when numbps = 0 (which is well defined behaviour, and is properly handled here, but better avoid it to detect real issues)

This commit is contained in:
Even Rouault 2017-08-16 18:29:59 +02:00
parent 1e387de742
commit 8e6c371e66
1 changed files with 4 additions and 0 deletions

View File

@ -2155,6 +2155,10 @@ static void opj_t1_encode_cblk(opj_t1_t *t1,
cblk->numbps = max ? (OPJ_UINT32)((opj_int_floorlog2(max) + 1) - cblk->numbps = max ? (OPJ_UINT32)((opj_int_floorlog2(max) + 1) -
T1_NMSEDEC_FRACBITS) : 0; T1_NMSEDEC_FRACBITS) : 0;
if (cblk->numbps == 0) {
cblk->totalpasses = 0;
return;
}
bpno = (OPJ_INT32)(cblk->numbps - 1); bpno = (OPJ_INT32)(cblk->numbps - 1);
passtype = 2; passtype = 2;