Skip to content

Commit

Permalink
opj_dwt_decode_tile(): avoid potential UndefinedBehaviorSanitizer 'ap…
Browse files Browse the repository at this point in the history
…plying zero offset to null pointer' (fixes #1505)
  • Loading branch information
rouault committed Feb 18, 2024
1 parent b0e83a1 commit d903fbb
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 d903fbb

Please sign in to comment.