summaryrefslogtreecommitdiff
path: root/crates/typst-layout
diff options
context:
space:
mode:
authorMax <me@mkor.je>2024-11-26 12:39:00 +0000
committerGitHub <noreply@github.com>2024-11-26 12:39:00 +0000
commit39e41ba3c6e8b78324f30b6513c81f31b84472d9 (patch)
tree259c915dcdcba67437f878f427b3d7b2ff992ce0 /crates/typst-layout
parentfd5e642fb495e98bde0f7e7fd16dca7ac355c60a (diff)
Fix `path` with infinite length causing panic (#5457)
Diffstat (limited to 'crates/typst-layout')
-rw-r--r--crates/typst-layout/src/shapes.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/typst-layout/src/shapes.rs b/crates/typst-layout/src/shapes.rs
index 81be1219..a3502172 100644
--- a/crates/typst-layout/src/shapes.rs
+++ b/crates/typst-layout/src/shapes.rs
@@ -114,6 +114,10 @@ pub fn layout_path(
path.close_path();
}
+ if !size.is_finite() {
+ bail!(elem.span(), "cannot create path with infinite length");
+ }
+
// Prepare fill and stroke.
let fill = elem.fill(styles);
let fill_rule = elem.fill_rule(styles);