Skip to content

Commit

Permalink
Fix case when the JPEG segment has a length of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricefisher64 committed Jan 29, 2024
1 parent a10e1f3 commit 5662b20
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 5662b20

Please sign in to comment.