mirror of
https://github.com/typst/typst
synced 2025-06-28 16:22:53 +08:00
Fix path
with infinite length causing panic (#5457)
This commit is contained in:
parent
fd5e642fb4
commit
39e41ba3c6
@ -114,6 +114,10 @@ pub fn layout_path(
|
|||||||
path.close_path();
|
path.close_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !size.is_finite() {
|
||||||
|
bail!(elem.span(), "cannot create path with infinite length");
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare fill and stroke.
|
// Prepare fill and stroke.
|
||||||
let fill = elem.fill(styles);
|
let fill = elem.fill(styles);
|
||||||
let fill_rule = elem.fill_rule(styles);
|
let fill_rule = elem.fill_rule(styles);
|
||||||
|
@ -90,3 +90,7 @@
|
|||||||
--- line-bad-point-component-type ---
|
--- line-bad-point-component-type ---
|
||||||
// Error: 14-26 expected relative length, found angle
|
// Error: 14-26 expected relative length, found angle
|
||||||
#line(start: (3deg, 10pt), length: 5cm)
|
#line(start: (3deg, 10pt), length: 5cm)
|
||||||
|
|
||||||
|
--- line-infinite-length ---
|
||||||
|
// Error: 2-54 cannot create line with infinite length
|
||||||
|
#line(start: (0pt, 0pt), end: (float.inf * 1pt, 0pt))
|
||||||
|
@ -71,6 +71,10 @@
|
|||||||
// Error: 7-31 point array must contain exactly two entries
|
// Error: 7-31 point array must contain exactly two entries
|
||||||
#path(((0%, 0%), (0%, 0%, 0%)))
|
#path(((0%, 0%), (0%, 0%, 0%)))
|
||||||
|
|
||||||
|
--- path-infinite-length ---
|
||||||
|
// Error: 2-42 cannot create path with infinite length
|
||||||
|
#path((0pt, 0pt), (float.inf * 1pt, 0pt))
|
||||||
|
|
||||||
--- issue-path-in-sized-container ---
|
--- issue-path-in-sized-container ---
|
||||||
// Paths used to implement `LayoutMultiple` rather than `LayoutSingle` without
|
// Paths used to implement `LayoutMultiple` rather than `LayoutSingle` without
|
||||||
// fulfilling the necessary contract of respecting region expansion.
|
// fulfilling the necessary contract of respecting region expansion.
|
||||||
|
@ -51,3 +51,7 @@
|
|||||||
--- polygon-bad-point-array ---
|
--- polygon-bad-point-array ---
|
||||||
// Error: 10-17 point array must contain exactly two entries
|
// Error: 10-17 point array must contain exactly two entries
|
||||||
#polygon((50pt,))
|
#polygon((50pt,))
|
||||||
|
|
||||||
|
--- polygon-infinite-size ---
|
||||||
|
// Error: 2-57 cannot create polygon with infinite size
|
||||||
|
#polygon((0pt, 0pt), (0pt, 1pt), (float.inf * 1pt, 0pt))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user