Skip to content

Commit

Permalink
fix(exif): #19 freeze when checking broken file
Browse files Browse the repository at this point in the history
  • Loading branch information
mindeng committed Nov 18, 2024
1 parent 1f5b02f commit 1c3bc2a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/exif/exif_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,14 @@ impl Iterator for ExifIter {

match entry {
IfdEntry::IfdNew(new_ifd) => {
if new_ifd.offset <= ifd.offset {
tracing::debug!(
?tag_code,
?new_ifd,
"bad new SUB-IFD: offset is smaller than current IFD"
);
continue;
}
let is_subifd = if new_ifd.ifd_idx == ifd.ifd_idx {
// Push the current ifd before enter sub-ifd.
self.ifds.push(ifd);
Expand Down

0 comments on commit 1c3bc2a

Please sign in to comment.