From 0312f1ea55ad9ab7add256ed4fd4f743193d477b Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 5 Oct 2026 13:41:38 +0700 Subject: [PATCH] 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 --- crates/engine/tests/import_fuzz.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/tests/import_fuzz.rs b/crates/engine/tests/import_fuzz.rs index 446590c2..b329180b 100644 --- a/crates/engine/tests/import_fuzz.rs +++ b/crates/engine/tests/import_fuzz.rs @@ -727,7 +727,9 @@ fn paste_from_elsewhere(cmd: &str, p: Value) -> Result<(), TestCaseError> { let mut s = vectorcraft_engine::Session::new(); s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); 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());