diff options
| author | mayeut <mayeut@users.noreply.github.com> | 2023-09-23 11:02:54 +0200 |
|---|---|---|
| committer | mayeut <mayeut@users.noreply.github.com> | 2023-09-23 12:50:57 +0200 |
| commit | d23e0284c9be174cc6daaa594c1139076771e16b (patch) | |
| tree | d442dd10e7a11500b68d5ac11f43c5969856ce9b /tests | |
| parent | 1ee6d115e80036d1d38bad7f95a680bfc612c1bf (diff) | |
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
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/nonregression/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | tests/nonregression/md5refs.txt | 1 | ||||
| -rw-r--r-- | tests/nonregression/test_suite.ctest.in | 4 |
3 files changed, 6 insertions, 0 deletions
diff --git a/tests/nonregression/CMakeLists.txt b/tests/nonregression/CMakeLists.txt index c515ae61..05fce40c 100644 --- a/tests/nonregression/CMakeLists.txt +++ b/tests/nonregression/CMakeLists.txt @@ -84,6 +84,7 @@ set(BLACKLIST_JPEG2000 issue823.jp2 #kdu_jp2info ok issue826.jp2 #inspection reveales that the transformation value is out of range oss-fuzz2785.jp2 #inspection reveales that the transformation value is out of range + issue1438.j2k ) file(GLOB_RECURSE OPJ_DATA_NR_LIST diff --git a/tests/nonregression/md5refs.txt b/tests/nonregression/md5refs.txt index 66fbcda4..b1558024 100644 --- a/tests/nonregression/md5refs.txt +++ b/tests/nonregression/md5refs.txt @@ -397,3 +397,4 @@ c34637a0f218e4074936e0c89534c5b5 tnsot_zero_missing_eoc.png 33aeb45c59383bb4c2d3671f6431c718 Bretagne1_ht_lossy.j2k.png c34637a0f218e4074936e0c89534c5b5 byte.jph.png c34637a0f218e4074936e0c89534c5b5 byte_causal.jhc.png +bc4f704c723329147bf6601a8b113bb2 huge-tile-size.png diff --git a/tests/nonregression/test_suite.ctest.in b/tests/nonregression/test_suite.ctest.in index 60e477cc..6dd70c63 100644 --- a/tests/nonregression/test_suite.ctest.in +++ b/tests/nonregression/test_suite.ctest.in @@ -657,3 +657,7 @@ opj_decompress -i @INPUT_NR_PATH@/htj2k/Bretagne1_ht.j2k -o @TEMP_PATH@/Bretagne opj_decompress -i @INPUT_NR_PATH@/htj2k/Bretagne1_ht_lossy.j2k -o @TEMP_PATH@/Bretagne1_ht_lossy.j2k.png opj_decompress -i @INPUT_NR_PATH@/htj2k/byte.jph -o @TEMP_PATH@/byte.jph.png opj_decompress -i @INPUT_NR_PATH@/htj2k/byte_causal.jhc -o @TEMP_PATH@/byte_causal.jhc.png + +# huge tile size +opj_decompress -i @INPUT_NR_PATH@/huge-tile-size.jp2 -o @TEMP_PATH@/huge-tile-size.png +!opj_decompress -i @INPUT_NR_PATH@/issue1438.j2k -o @TEMP_PATH@/issue1438.png |
