Never crash: PDF close-path operators and CFF outlines without a current point
The s, b and b* operators closed the path even when there was no current point, which kurbo asserts against (a panic in debug builds; found by fuzzing). Close only when a subpath is open. CFF charstrings that draw before their first rmoveto now start the subpath at the current point, as Type 1 charstrings already did. Denies the panic lints in the crate (it had no panic sites). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
10644a83aa
commit
8e4e29844e
@@ -295,3 +295,12 @@ fn truncated_and_corrupt_eps_never_panic() {
|
||||
assert!(r.is_ok(), "{}", String::from_utf8_lossy(prog));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn closing_an_empty_path_is_a_no_op() {
|
||||
// "s", "b" and "b*" closed the path without a current point (kurbo asserts on that).
|
||||
for ops in ["s", "b", "b*", "0 0 m 50 0 l 50 50 l b s b*", "f s 10 10 m 20 20 l s"] {
|
||||
let doc = parse(&page_pdf(ops, "", vec![])).unwrap();
|
||||
let _ = render(&doc);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user