summaryrefslogtreecommitdiff
path: root/src/lib/openjp2
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2024-02-18 17:43:23 +0100
committerGitHub <noreply@github.com>2024-02-18 17:43:23 +0100
commit0f3ca8108a1f673001e72ce32eb4912ab2e49e25 (patch)
tree21eec3a1fd185d979a035c468b32f60eb8a1ad5a /src/lib/openjp2
parentddffa33fdfe5d54d9484fb5be40260acd4e694f4 (diff)
parentd903fbb4ab9ccf9b96c8bc7398fafc0007505a37 (diff)
Merge pull request #1510 from rouault/fix_1505
opj_dwt_decode_tile(): avoid potential UndefinedBehaviorSanitizer 'applying zero offset to null pointer' (fixes #1505)
Diffstat (limited to 'src/lib/openjp2')
-rw-r--r--src/lib/openjp2/dwt.c4
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);