From 5662b207b898e6ac2d700dfdb9c956808c4a027e Mon Sep 17 00:00:00 2001 From: Maurice Fisher Date: Mon, 29 Jan 2024 11:07:48 -0500 Subject: [PATCH] Fix case when the JPEG segment has a length of 0 --- jfifdump/src/reader.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jfifdump/src/reader.rs b/jfifdump/src/reader.rs index 1e24ce5..1d4f4c9 100644 --- a/jfifdump/src/reader.rs +++ b/jfifdump/src/reader.rs @@ -63,7 +63,8 @@ impl Reader { fn read_length(&mut self) -> Result { let length = self.read_u16()? as usize; - if length <= 2 { + // lengths 0 and greater are allowed + if length < 2 { return Err(JfifError::InvalidMarkerLength(length)); }