Skip to content

Commit

Permalink
disable check for cyclic iref references (#993)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 17, 2023
1 parent bfeb00c commit 18d4e55
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libheif/box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2652,6 +2652,20 @@ Error Box_iref::parse(BitstreamRange& range)
}


#if 0
// Note: This input sanity check does not work as expected.
// Its idea was to prevent infinite recursions while decoding when the input file
// contains cyclic references. However, apparently there are cases where cyclic
// references are actually allowed, like with images that have premultiplied alpha channels:
// | Box: iref -----
// | size: 40 (header size: 12)
// | reference with type 'auxl' from ID: 2 to IDs: 1
// | reference with type 'prem' from ID: 1 to IDs: 2
//
// TODO: implement the infinite recursion detection in a different way. E.g. by passing down
// the already processed item-ids while decoding an image and checking whether the current
// item has already been decoded before.

// --- check for cyclic references

for (const auto& ref : m_references) {
Expand Down Expand Up @@ -2687,6 +2701,7 @@ Error Box_iref::parse(BitstreamRange& range)
}
}
}
#endif

return range.get_error();
}
Expand Down

0 comments on commit 18d4e55

Please sign in to comment.