Pass the configured SVG tree depth to shared parsing

This commit is contained in:
Dylan M. Taylor committed 2026-11-13 06:56:37 -05:00
1 parent db1e6a5e9d
commit 25e768ecb6
1 file changed
+4
+4
View File
@@ -407,6 +407,10 @@ fn tree_limits(depth: usize, raster_pixels: u64) -> craft_svg::tree::Limits {
// 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),
// The shared default is intentionally conservative for general consumers. PhotoCraft
// already guards XML nesting and reference expansion against its 512-level parser
// budget, so pass that same explicit limit through instead of inheriting 256.
tree_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),