Skip to content

Commit

Permalink
opj_t2_read_packet_header(): fix unsigned-integer-overflow at t2.c:12…
Browse files Browse the repository at this point in the history
…34 (#1488)
  • Loading branch information
headshog authored and rouault committed Dec 8, 2023
1 parent b0e83a1 commit 96bad2a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/openjp2/t2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,11 @@ static OPJ_BOOL opj_t2_read_packet_header(opj_t2_t* p_t2,
++i;
}

if ((OPJ_UINT32)l_band->numbps + 1 < i) {
opj_bio_destroy(l_bio);
return OPJ_FALSE;
}

l_cblk->Mb = (OPJ_UINT32)l_band->numbps;
l_cblk->numbps = (OPJ_UINT32)l_band->numbps + 1 - i;
l_cblk->numlenbits = 3;
Expand Down

0 comments on commit 96bad2a

Please sign in to comment.