mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 23:42:27 +00:00
Cover TIFF decode preflight limits
This commit is contained in:
1 parent
c339a9e471
commit
b16c5908ae
1 file changed
+3
@@ -98,6 +98,9 @@ mod tests {
|
||||
let image = crate::Image::from_u8(2, 3, crate::ChannelLayout::Rgb, vec![42; 18]).unwrap();
|
||||
let bytes = crate::encode(&image, crate::Format::Tiff, &crate::EncodeOptions::default()).unwrap();
|
||||
assert_eq!(header(&bytes, 6).unwrap(), (2, 3, 1));
|
||||
let info = decode_info(&bytes, 6).unwrap();
|
||||
assert_eq!((info.width, info.height, info.bit_depth), (2, 3, 8));
|
||||
assert!(matches!(decode_info(&bytes, 5), Err(Error::TooLarge { width: 2, height: 3 })));
|
||||
assert!(matches!(header(&bytes, 5), Err(Error::TooLarge { width: 2, height: 3 })));
|
||||
assert!(header(&bytes[..8], 6).is_err());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user