diff --git a/crates/image/src/zlib.rs b/crates/image/src/zlib.rs index 37d627f..fa2ec46 100644 --- a/crates/image/src/zlib.rs +++ b/crates/image/src/zlib.rs @@ -25,8 +25,6 @@ pub enum ZlibError { PresetDictionaryNotSupported, /// Adler-32 checksum of decompressed data does not match the trailer. ChecksumMismatch { expected: u32, actual: u32 }, - /// Input is too short to contain the Adler-32 trailer. - MissingTrailer, /// DEFLATE decompression error. Deflate(deflate::DeflateError), } @@ -51,7 +49,6 @@ impl fmt::Display for ZlibError { "Adler-32 checksum mismatch: expected {expected:#010x}, got {actual:#010x}" ) } - Self::MissingTrailer => write!(f, "missing Adler-32 trailer"), Self::Deflate(e) => write!(f, "deflate error: {e}"), } } @@ -143,10 +140,6 @@ pub fn zlib_decompress(input: &[u8]) -> Result> { // Compressed data starts after the 2-byte header // Adler-32 checksum occupies the last 4 bytes - if input.len() < 6 { - return Err(ZlibError::MissingTrailer); - } - let compressed = &input[2..input.len() - 4]; let trailer = &input[input.len() - 4..]; @@ -250,10 +243,6 @@ mod tests { .to_string(), "Adler-32 checksum mismatch: expected 0x12345678, got 0xabcdef01" ); - assert_eq!( - ZlibError::MissingTrailer.to_string(), - "missing Adler-32 trailer" - ); assert_eq!( ZlibError::Deflate(deflate::DeflateError::UnexpectedEof).to_string(), "deflate error: unexpected end of input"