diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2024-02-18 17:17:00 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2024-02-18 17:17:00 +0100 |
| commit | d903fbb4ab9ccf9b96c8bc7398fafc0007505a37 (patch) | |
| tree | 4cf1fc38e1db2d4cfa29fb3b21f3779737d67ae3 /src/lib | |
| parent | b0e83a1b3399f5f847250bdc044a96f22cb156d7 (diff) | |
opj_dwt_decode_tile(): avoid potential UndefinedBehaviorSanitizer 'applying zero offset to null pointer' (fixes #1505)
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/dwt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/openjp2/dwt.c b/src/lib/openjp2/dwt.c index abc500ec..6b18c5dd 100644 --- a/src/lib/openjp2/dwt.c +++ b/src/lib/openjp2/dwt.c @@ -2083,7 +2083,9 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, OPJ_SIZE_T h_mem_size; int num_threads; - if (numres == 1U) { + /* Not entirely sure for the return code of w == 0 which is triggered per */ + /* https://github.com/uclouvain/openjpeg/issues/1505 */ + if (numres == 1U || w == 0) { return OPJ_TRUE; } num_threads = opj_thread_pool_get_thread_count(tp); |
