fix: use `opj_uint_ceildiv` instead of `opj_int_ceildiv` when necessary
authormayeut <mayeut@users.noreply.github.com>
Sat, 23 Sep 2023 09:02:54 +0000 (11:02 +0200)
committermayeut <mayeut@users.noreply.github.com>
Sat, 23 Sep 2023 10:50:57 +0000 (12:50 +0200)
commitd23e0284c9be174cc6daaa594c1139076771e16b
treed442dd10e7a11500b68d5ac11f43c5969856ce9b
parent1ee6d115e80036d1d38bad7f95a680bfc612c1bf
fix: use `opj_uint_ceildiv` instead of `opj_int_ceildiv` when necessary

There are a bunch of loc where we can see a usage of `opj_int_ceildiv`:
```
(OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)a, (OPJ_INT32)b);
```
where a & b are `OPJ_UINT32`.

This can lead to overflow/underflow for some a/b combinations.
Replace those calls by `opj_uint_ceildiv` instead to always get a correct result.

This also allows some valid single tile images with huge tile size to be decoded properly.
Fix #1438
src/lib/openjp2/j2k.c
tests/nonregression/CMakeLists.txt
tests/nonregression/md5refs.txt
tests/nonregression/test_suite.ctest.in