Skip to content

Commit

Permalink
Show error if 'iref' box has no references
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 28, 2024
1 parent 6110752 commit 166d77f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libheif/box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3421,7 +3421,13 @@ Error Box_iref::parse(BitstreamRange& range, const heif_security_limits* limits)
ref.from_item_ID = static_cast<uint32_t>(range.read_uint(read_len));
uint16_t nRefs = range.read16();

if (nRefs > limits->max_items) {
if (nRefs==0) {
return {heif_error_Invalid_input,
heif_suberror_Unspecified,
"Input file has an 'iref' box with no references."};
}

if (limits->max_items && nRefs > limits->max_items) {
std::stringstream sstr;
sstr << "Number of references in iref box (" << nRefs << ") exceeds the security limits of " << limits->max_items << " references.";

Expand Down

0 comments on commit 166d77f

Please sign in to comment.