M14.4: the pasted-PDF fuzz test accepts a paste that refuses out-of-range art

pasted_pdf_never_panics failed at random (about one run in four at 256
cases): a mutated digit turns a curve coordinate like 245.18535 into
245018535, so the pasted art spans ~1e8 pt, beyond MAX_COORD, and
edit.paste rightly refuses it with "result would exceed the canvas",
leaving the document unchanged. The helper unwrapped that result. The
test is about never panicking, so paste_from_elsewhere now ignores an
Err from edit.paste, with a comment saying why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic 2026-10-05 13:41:38 +07:00
parent e2e36f221b
commit 0312f1ea55
1 changed files with 3 additions and 1 deletions

View File

@ -727,7 +727,9 @@ fn paste_from_elsewhere(cmd: &str, p: Value) -> Result<(), TestCaseError> {
let mut s = vectorcraft_engine::Session::new(); let mut s = vectorcraft_engine::Session::new();
s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap();
if s.execute(cmd, &p).is_ok() { if s.execute(cmd, &p).is_ok() {
s.execute("edit.paste", &json!({"center": [50, 50]})).unwrap(); // Paste may refuse what it was given, e.g. a damaged PDF whose art spans more than the
// canvas ("result would exceed the canvas"): an error is a fine outcome, a panic isn't.
let _ = s.execute("edit.paste", &json!({"center": [50, 50]}));
} }
}); });
prop_assert!(r.is_ok(), "{cmd}: panicked: {:?}", r.err()); prop_assert!(r.is_ok(), "{cmd}: panicked: {:?}", r.err());