From bc505410f80162dda82f7c0dbef6a60d4bbbe769 Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:18:24 +0100 Subject: [PATCH 01/17] fix(xfa): remove redundant defaults from codec options --- crates/xfa/src/image.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/xfa/src/image.rs b/crates/xfa/src/image.rs index ce40dfa6b0..2a6d0ddbf5 100644 --- a/crates/xfa/src/image.rs +++ b/crates/xfa/src/image.rs @@ -169,7 +169,7 @@ pub fn decode(data: &[u8]) -> Result { } match kind(data) { Some(Kind::Png) => { - let opts = craft_image_codecs::DecodeOptions { keep_orientation: true, limits: decode_limits(), ..Default::default() }; + let opts = craft_image_codecs::DecodeOptions { keep_orientation: true, limits: decode_limits() }; let img = craft_image_codecs::decode_as_with(craft_image_codecs::Format::Png, data, &opts).map_err(|e| match e { craft_image_codecs::CodecError::LimitExceeded(_) => too_big(), other => bad(other.to_string()), @@ -212,7 +212,7 @@ pub fn decode(data: &[u8]) -> Result { _ => craft_image_codecs::Format::Tiff, }; let data = if k == Kind::Bmp { bmp_with_pixel_offset(data) } else { std::borrow::Cow::Borrowed(data) }; - let opts = craft_image_codecs::DecodeOptions { keep_orientation: false, limits: decode_limits(), ..Default::default() }; + let opts = craft_image_codecs::DecodeOptions { keep_orientation: false, limits: decode_limits() }; let img = craft_image_codecs::decode_as_with(format, &data, &opts).map_err(|e| match e { craft_image_codecs::CodecError::LimitExceeded(_) => too_big(), other => bad(other.to_string()), From 6bdab5d64cc8d1e2dd15fd47d3d45622af1f4d62 Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:18:44 +0100 Subject: [PATCH 02/17] fix(xfa): initialize form-data parsing options completely --- crates/xfa/src/data/import.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/xfa/src/data/import.rs b/crates/xfa/src/data/import.rs index 0aab2cc1f1..23a72e8f98 100644 --- a/crates/xfa/src/data/import.rs +++ b/crates/xfa/src/data/import.rs @@ -192,7 +192,7 @@ pub fn parse_data_file(text: &str, expect_root: Option<&str>) -> Result MAX_IMPORT_DEPTH { return Err(XfaError::TooLarge(format!("the data file nests more than {MAX_IMPORT_DEPTH} levels deep"))); } - let opts = crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() }; + let opts = crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES }; let parsed = crate::xml::Document::parse_with_options(text, opts).map_err(|e| XfaError::Malformed(format!("the data file is not XML: {e}")))?; let root = parsed.root_element(); let local = root.tag_name().name(); @@ -304,7 +304,7 @@ pub fn export_data(doc: &Document, xdp: bool, pdf_name: &str) -> Result Result, ()> { - let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() }; + let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES }; if crate::xml_nesting_depth(text) > crate::MAX_XML_DEPTH { return Err(()); } From b429031b7e15ddea6bec7cabb5856ea46afdf37a Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:18:51 +0100 Subject: [PATCH 03/17] fix(xfa): initialize merged-packet parsing options completely --- crates/xfa/src/data/merge.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/xfa/src/data/merge.rs b/crates/xfa/src/data/merge.rs index a5d3a38212..e2b5d2d08c 100644 --- a/crates/xfa/src/data/merge.rs +++ b/crates/xfa/src/data/merge.rs @@ -117,7 +117,7 @@ fn merge(text: &str, within: Within, op: Op, warnings: &mut Vec) -> Merg warnings.push("The XFA data nests XML elements deeper than the reader accepts; the field values were not written to it".into()); return Merged::Failed; } - let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() }; + let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES }; // A packet of an array may use the prefixes the XDP envelope declares: read it inside // an element declaring the usual ones. let wrapped; @@ -465,7 +465,7 @@ pub(super) fn readable(text: &str, within: Within, warnings: &mut Vec) - warnings.push(format!("The XFA data would be larger than {} MB; it was not written", MAX_PACKET_WRITE >> 20)); return false; } - let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() }; + let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES }; let ok = crate::xml::Document::parse_with_options(text, opts()).is_ok() || (within == Within::Packet && crate::xml::Document::parse_with_options(&format!("{WRAP_OPEN}{text}{WRAP_CLOSE}"), opts()).is_ok()); if !ok { From d15876004348506ce2d18bf22ae4019e1a76df64 Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:19:18 +0100 Subject: [PATCH 04/17] fix(xfa): initialize path parsing options completely --- crates/xfa/src/data/path.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/xfa/src/data/path.rs b/crates/xfa/src/data/path.rs index d7bc2c7584..228645a641 100644 --- a/crates/xfa/src/data/path.rs +++ b/crates/xfa/src/data/path.rs @@ -17,7 +17,7 @@ pub fn parse_datasets(xdp: &str) -> Option { if crate::xml_nesting_depth(xdp) > crate::MAX_XML_DEPTH { return None; } - let opts = crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() }; + let opts = crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES }; let doc = crate::xml::Document::parse_with_options(xdp, opts).ok()?; let datasets = doc.descendants().find(|n| n.is_element() && n.tag_name().name() == "datasets")?; let data = datasets.children().find(|n| n.is_element() && n.tag_name().name() == "data")?; @@ -33,7 +33,7 @@ pub(super) fn parse_datasets_packet(text: &str) -> Option { if crate::xml_nesting_depth(text) > crate::MAX_XML_DEPTH { return None; } - let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() }; + let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES }; let wrapped; let doc = match crate::xml::Document::parse_with_options(text, opts()) { Ok(d) => d, From b45fcae35d3db598dc6a6d62ae0c66fcc359ccc7 Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:19:33 +0100 Subject: [PATCH 05/17] fix(xfa): initialize template parsing options completely --- crates/xfa/src/parse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/xfa/src/parse.rs b/crates/xfa/src/parse.rs index ec1df0e7d0..45aa7449dc 100644 --- a/crates/xfa/src/parse.rs +++ b/crates/xfa/src/parse.rs @@ -1266,7 +1266,7 @@ pub fn parse(xml: &str) -> Result<(Template, Vec), XfaError> { crate::MAX_XML_DEPTH ))); } - let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() }; + let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES }; let doc = crate::xml::Document::parse_with_options(xml, opts()).map_err(|e| XfaError::Malformed(format!("template XML: {e}")))?; let root = doc.root_element(); // The XDP's config packet has a