From 32ab43eab075511949c62ecaf95792e161fa7106 Mon Sep 17 00:00:00 2001 From: mtlcl410 Date: Thu, 5 Nov 2026 07:06:48 +0800 Subject: [PATCH] fix(xfa): the embedded-copy test allows the draw budget to stop it first With embedded values counted, the 1 MiB test budget can stop this draw before its last pass; the bound on what is copied out still holds. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Pq7HyDBXygTf7jcqdsjcfn --- crates/xfa/src/tests.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/xfa/src/tests.rs b/crates/xfa/src/tests.rs index a55d74498e..29e5e0da0a 100644 --- a/crates/xfa/src/tests.rs +++ b/crates/xfa/src/tests.rs @@ -3992,7 +3992,12 @@ fn embedded_values_are_copied_out_only_as_far_as_the_budget() { "# ); crate::layout::EMBED_COPIED.with(|c| c.set(0)); - layout_xml(&tpl).unwrap(); + // The draw budget counts embedded values too (1 MiB in tests), so it may stop the draw + // before its last pass; either way no more than this is copied out. + match layout_xml(&tpl) { + Ok(_) | Err(XfaError::TooLarge(_)) => {} + Err(e) => panic!("{e:?}"), + } let copied = crate::layout::EMBED_COPIED.with(|c| c.get()); // The draw is measured at most seven times before it is laid out once. assert!(copied <= 8 * text::MAX_EMBEDDED as u64 + 8 * 4 * 201, "{copied} bytes of embedded values copied");