Skip to content

Commit

Permalink
Merge pull request #944 from lovell/j2k-siz-segment-bounds
Browse files Browse the repository at this point in the history
Ensure correct JPEG2000 SIZ segment bounds check
  • Loading branch information
farindk authored Oct 4, 2023
2 parents 6635c50 + c6af00f commit 09a2634
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file not shown.
4 changes: 2 additions & 2 deletions libheif/jpeg2000.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,15 @@ JPEG2000_SIZ_segment jpeg2000_get_SIZ_segment(const HeifFile& file, heif_item_id
JPEG2000_SIZ_segment siz;

// space for full header and one component
if (i + 2 + 38 + 3 > data.size()) {
if (i + 2 + 40 + 3 > data.size()) {
return {};
}

// read number of components

int nComponents = read16(data, 40);

if (i + 2 + 38 + nComponents * 3 > data.size()) {
if (i + 2 + 40 + nComponents * 3 > data.size()) {
return {};
}

Expand Down

0 comments on commit 09a2634

Please sign in to comment.