Skip to content

Commit

Permalink
Merge pull request #1621 from Exiv2/mergify/bp/main/pr-1591
Browse files Browse the repository at this point in the history
Fix infinite loop caused by subBox with zero size. (backport #1591)
  • Loading branch information
kevinbackhouse authored May 11, 2021
2 parents b4b8061 + aac3463 commit 170b18d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/jp2image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ static void boxes_check(size_t b,size_t m)
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << "Jp2Image::encodeJp2Header subbox: "<< toAscii(subBox.type) << " length = " << subBox.length << std::endl;
#endif
enforce(subBox.length > 0, Exiv2::kerCorruptedMetadata);
enforce(subBox.length <= length - count, Exiv2::kerCorruptedMetadata);
count += subBox.length;
newBox.type = subBox.type;
Expand Down

0 comments on commit 170b18d

Please sign in to comment.