From 188d935887cb1ea2b9f058e8063718b03e1f27ee Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 15:41:20 +0000 Subject: [PATCH] Cover bounded PNG header probing --- crates/image-codecs/src/png_probe.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/image-codecs/src/png_probe.rs b/crates/image-codecs/src/png_probe.rs index 94e308add..7edda454d 100644 --- a/crates/image-codecs/src/png_probe.rs +++ b/crates/image-codecs/src/png_probe.rs @@ -165,6 +165,8 @@ mod tests { chunk(&mut bytes, b"eXIf", exif); chunk(&mut bytes, b"IEND", &[]); assert_eq!(header(&bytes).ok(), Some((2, 3, 6))); + assert!(matches!(header_with_max_pixels(&bytes, 5), Err(CodecError::LimitExceeded(_)))); + assert_eq!(declared_dimensions(&bytes), Some((2, 3))); assert!(header(&bytes[..34]).is_err()); let mut indexed = png(3); chunk(&mut indexed, b"IDAT", &[1]);