Align shared SVG depth budget with stack guard

This commit is contained in:
Dylan M. Taylor committed 2026-11-13 05:30:30 -05:00
1 parent a01746f28d
commit 9c6acefd5f
1 file changed
+3 -1
+3 -1
View File
@@ -404,7 +404,9 @@ fn parse(bytes: &[u8]) -> Result<Parsed, IoError> {
fn tree_limits(depth: usize, raster_pixels: u64) -> craft_svg::tree::Limits {
craft_svg::tree::Limits {
bytes: usize::try_from(MAX_INFLATED_BYTES).unwrap_or(usize::MAX),
depth,
// PhotoCraft's stack guard counts open tags; the shared SVG preflight counts every
// element, including a self-closing leaf. Allow that leaf at the same guarded depth.
depth: depth.saturating_add(1),
embedded_bytes: usize::try_from(MAX_BOUNDED_SVG_BYTES).unwrap_or(usize::MAX),
embedded_depth: MAX_EMBEDDED_SVG_DEPTH,
embedded_raster_pixels: raster_pixels.min(MAX_RASTER_PIXELS),