mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Align shared SVG depth budget with stack guard
This commit is contained in:
1 file changed
+3
-1
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user