Skip to content

Commit

Permalink
Fix runtime error: applying zero offset to null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiaoafeifei committed Sep 11, 2023
1 parent 1ee6d11 commit 7704dd1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/openjp2/tcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2324,6 +2324,11 @@ static OPJ_BOOL opj_tcd_dc_level_shift_decode(opj_tcd_t *p_tcd)
l_max);
++l_current_ptr;
}

if (!l_current_ptr) {
/* Avoid runtime error: applying zero offset to null pointer */
return OPJ_FALSE;
}
l_current_ptr += l_stride;
}
} else {
Expand All @@ -2342,6 +2347,11 @@ static OPJ_BOOL opj_tcd_dc_level_shift_decode(opj_tcd_t *p_tcd)
}
++l_current_ptr;
}

if (!l_current_ptr) {
/* Avoid runtime error: applying zero offset to null pointer */
return OPJ_FALSE;
}
l_current_ptr += l_stride;
}
}
Expand Down

0 comments on commit 7704dd1

Please sign in to comment.