diff --git a/crates/xfa/src/packets.rs b/crates/xfa/src/packets.rs
index f79b071c0e..4202ffbb55 100644
--- a/crates/xfa/src/packets.rs
+++ b/crates/xfa/src/packets.rs
@@ -7,6 +7,8 @@ use crate::XfaError;
/// Most decoded packet bytes read in total.
const MAX_XDP: usize = 64 << 20;
+/// Most bytes all filter stages of all packets may decode together.
+const MAX_DECODE_WORK: usize = 4 * MAX_XDP;
/// What was found in the XFA entry.
#[derive(Clone, Debug, Default, PartialEq)]
@@ -116,13 +118,17 @@ pub fn read_packets(doc: &Document) -> Result