Skip to content

Commit

Permalink
Merge pull request #7 from mauricefisher64/main
Browse files Browse the repository at this point in the history
Fix case when the JPEG segment has a length of 0
  • Loading branch information
vstroebel authored Jan 30, 2024
2 parents a10e1f3 + 5662b20 commit db0d3d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jfifdump/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ impl<R: Read> Reader<R> {
fn read_length(&mut self) -> Result<usize, JfifError> {
let length = self.read_u16()? as usize;

if length <= 2 {
// lengths 0 and greater are allowed
if length < 2 {
return Err(JfifError::InvalidMarkerLength(length));
}

Expand Down

0 comments on commit db0d3d0

Please sign in to comment.