Keep one regression for oversized image headers

This commit is contained in:
Codex
2026-12-01 20:47:06 +01:00
parent 3fa02146d0
commit 7481fd3af8
-12
View File
@@ -478,18 +478,6 @@ mod tests {
use vectorcraft_doc::{Document, ImageBlob, ImageObject};
use vectorcraft_geom::Affine;
#[test]
fn an_image_whose_header_declares_far_more_pixels_than_the_app_reads_is_left_out() {
// A real 8 × 8 PNG whose IHDR (width, height at 16..24) claims 65535 × 65535, with its CRC fixed.
let mut png = vec![];
image::DynamicImage::ImageRgb8(image::RgbImage::new(8, 8)).write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png).unwrap();
png[16..24].copy_from_slice(&[0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF]);
let crc =
!png[12..29].iter().fold(!0u32, |c, b| (0..8).fold(c ^ u32::from(*b), |c, _| if c & 1 == 1 { 0xEDB8_8320 ^ (c >> 1) } else { c >> 1 }));
png[29..33].copy_from_slice(&crc.to_be_bytes());
assert!(super::embed(&ImageBlob::png(png), false, true, super::SourceProfiles::Keep).is_none());
}
#[test]
fn an_image_whose_header_declares_far_more_pixels_than_the_app_reads_is_left_out() {
// A real 8 × 8 PNG whose IHDR (width, height at 16..24) claims 65535 × 65535, with its CRC fixed.