Skip to content

Commit

Permalink
Merge pull request #1510 from rouault/fix_1505
Browse files Browse the repository at this point in the history
opj_dwt_decode_tile(): avoid potential UndefinedBehaviorSanitizer 'applying zero offset to null pointer' (fixes #1505)
  • Loading branch information
rouault authored Feb 18, 2024
2 parents ddffa33 + d903fbb commit 0f3ca81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/openjp2/dwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0f3ca81

Please sign in to comment.