diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-08-16 18:29:59 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-08-16 18:29:59 +0200 |
| commit | 8e6c371e66d9c579048fd336cc3365869486080a (patch) | |
| tree | 56586d0b25b0d2d1b1f9488d32bdd45a867cf812 /src/lib | |
| parent | 1e387de74273c4dac618df94475556541c1caf3e (diff) | |
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)
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/t1.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/openjp2/t1.c b/src/lib/openjp2/t1.c index bd1a8800..eb5d6e0e 100644 --- a/src/lib/openjp2/t1.c +++ b/src/lib/openjp2/t1.c @@ -2155,6 +2155,10 @@ static void opj_t1_encode_cblk(opj_t1_t *t1, cblk->numbps = max ? (OPJ_UINT32)((opj_int_floorlog2(max) + 1) - T1_NMSEDEC_FRACBITS) : 0; + if (cblk->numbps == 0) { + cblk->totalpasses = 0; + return; + } bpno = (OPJ_INT32)(cblk->numbps - 1); passtype = 2; |
