From cb5243bf785b9ea3814101a88976cf6c5cad23c3 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 11 Nov 2026 09:27:55 +0100 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFFix=20main:=20SVG=20raster=20depth=20t?= =?UTF-8?q?est=20after=20#11009=20and=20#10953?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #11009 added a check that rasterize_rgba8 renders 500 nested opacity groups. #10953, merged after it, refuses whole-drawing rasterisation past 200 nested layers. The test now expects that refusal as an error, and still renders a drawing within the limit on the same 512 KiB stack. --- crates/io/tests/it/svg.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/io/tests/it/svg.rs b/crates/io/tests/it/svg.rs index fc398796cb..7402bf290d 100644 --- a/crates/io/tests/it/svg.rs +++ b/crates/io/tests/it/svg.rs @@ -448,7 +448,16 @@ fn retained_deep_svg_groups_lower_render_and_drop_on_a_bounded_worker() { let (preview, _) = svg::import_svg_preview_with_work("retained.svg", source.as_bytes(), u64::MAX).unwrap(); assert_eq!(preview.document.max_group_depth(), 100); assert!(pixel(&preview.document)[3] > 0.5); - let (w, h, pixels) = svg::rasterize_rgba8(source.as_bytes()).unwrap(); + // Whole-drawing rasterisation refuses more than 200 nested layers (#10953) with an + // error, not a crash; a drawing within that limit still renders on this small stack. + let refused = svg::rasterize_rgba8(source.as_bytes()).unwrap_err().to_string(); + assert!(refused.contains("layers are nested too deeply"), "{refused}"); + let within = format!( + "{}{}", + "".repeat(150), + "".repeat(150) + ); + let (w, h, pixels) = svg::rasterize_rgba8(within.as_bytes()).unwrap(); assert_eq!((w, h), (8, 8)); assert!(pixels[3] > 127); })