Skip to content

Commit

Permalink
fix(exif): range start index panic in src/exif/exif_iter.rs #25
Browse files Browse the repository at this point in the history
  • Loading branch information
mindeng committed Nov 19, 2024
1 parent db39c8d commit daef45f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/exif/exif_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,15 @@ impl ExifIter {
}
Err(e) => return Err(e.clone().into()),
};
if offset as usize >= iter.input.len() {
return Err(crate::Error::ParseFailed(
"GPSInfo offset is out of range".into(),
));
}

let mut gps_subifd = match IfdIter::try_new(
gps.ifd,
iter.input.partial(&iter.input[offset as usize..]),
iter.input.partial(&iter.input[offset as usize..]), // Safe-slice
offset,
iter.tiff_header.endian,
iter.tz.clone(),
Expand Down

0 comments on commit daef45f

Please sign in to comment.