Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

deps: bump tar, zip, roxmltree, rustls-webpki and symphonia to their latest versions (#5381)

Dylan M. Taylorf76dbb9e8c44
diff --git a/Cargo.lock b/Cargo.lock
index 8fd7c9133..2aea77107 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4544,7 +4544,7 @@ dependencies = [
"pdfcraft-content",
"pdfcraft-cos",
"pdfcraft-model",
- "roxmltree 0.20.0",
+ "roxmltree 0.21.2",
]
[[package]]
@@ -4707,7 +4707,7 @@ dependencies = [
"pdfcraft-cos",
"pdfcraft-fonts",
"png 0.18.1",
- "roxmltree 0.20.0",
+ "roxmltree 0.21.2",
"sha2 0.11.1",
"thiserror 2.0.21",
]
@@ -4720,7 +4720,7 @@ dependencies = [
"pdfcraft-cos",
"pdfcraft-forms",
"pdfcraft-model",
- "roxmltree 0.20.0",
+ "roxmltree 0.21.2",
"thiserror 2.0.21",
]
@@ -6753,7 +6753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
- "getrandom 0.4.3",
+ "getrandom 0.3.4",
"once_cell",
"rustix 1.1.5",
"windows-sys 0.59.0",
@@ -8594,9 +8594,9 @@ dependencies = [
[[package]]
name = "zip"
-version = "9.1.0"
+version = "9.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2886b00003a72c4ccee3f42cfc34908d33b2508a74d827dc2a4244706475c704"
+checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb"
dependencies = [
"crc32fast",
"flate2",
diff --git a/crates/preflight/Cargo.toml b/crates/preflight/Cargo.toml
index 082e44fc5..99a72d9b6 100644
--- a/crates/preflight/Cargo.toml
+++ b/crates/preflight/Cargo.toml
@@ -14,7 +14,7 @@ workspace = true
pdfcraft-content = { workspace = true }
pdfcraft-cos = { workspace = true }
pdfcraft-model = { workspace = true }
-roxmltree = "0.20"
+roxmltree = "0.21"
[dev-dependencies]
flate2 = { workspace = true }
diff --git a/crates/preflight/src/xmp.rs b/crates/preflight/src/xmp.rs
index 0aaab12b2..7a54d70a1 100644
--- a/crates/preflight/src/xmp.rs
+++ b/crates/preflight/src/xmp.rs
@@ -34,7 +34,7 @@ fn parsed_identifier(xmp: &str, namespace: &str, local: &str) -> Result<Option<S
if !xml_limits_ok(xmp) {
return Err(());
}
- let options = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: 100_000 };
+ let options = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: 100_000, ..Default::default() };
let doc = roxmltree::Document::parse_with_options(xmp, options).map_err(|_| ())?;
for node in doc.descendants().filter(roxmltree::Node::is_element) {
if let Some(value) = node.attribute((namespace, local)) {
diff --git a/crates/xfa/Cargo.toml b/crates/xfa/Cargo.toml
index d91701805..687efaf18 100644
--- a/crates/xfa/Cargo.toml
+++ b/crates/xfa/Cargo.toml
@@ -13,7 +13,7 @@ workspace = true
[dependencies]
pdfcraft-cos = { workspace = true }
pdfcraft-fonts = { workspace = true }
-roxmltree = "0.20"
+roxmltree = "0.21"
base64 = "0.23"
png = "0.18"
sha2 = "0.11"
diff --git a/crates/xfa/src/data/import.rs b/crates/xfa/src/data/import.rs
index 7582d8676..006f4ff73 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<Vec<Impo
if crate::xml_nesting_depth(text) > MAX_IMPORT_DEPTH {
return Err(XfaError::TooLarge(format!("the data file nests more than {MAX_IMPORT_DEPTH} levels deep")));
}
- let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES };
+ let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() };
let parsed = roxmltree::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,14 +304,14 @@ pub fn export_data(doc: &Document, xdp: bool, pdf_name: &str) -> Result<String,
/// data element), each with the namespaces it uses declared on it. `Ok(None)`: no datasets
/// element; `Err`: the text can't be read.
fn datasets_markup(text: &str) -> Result<Option<(String, String)>, ()> {
- let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES };
+ let opts = || roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() };
if crate::xml_nesting_depth(text) > crate::MAX_XML_DEPTH {
return Err(());
}
let wrapped = format!("{WRAP_OPEN}{text}{WRAP_CLOSE}");
- let (src, parsed) = match roxmltree::Document::parse_with_options(text, opts) {
+ let (src, parsed) = match roxmltree::Document::parse_with_options(text, opts()) {
Ok(d) => (text, d),
- Err(_) => (wrapped.as_str(), roxmltree::Document::parse_with_options(&wrapped, opts).map_err(|_| ())?),
+ Err(_) => (wrapped.as_str(), roxmltree::Document::parse_with_options(&wrapped, opts()).map_err(|_| ())?),
};
let Some(ds) = parsed.descendants().find(|n| n.is_element() && n.tag_name().name() == "datasets") else { return Ok(None) };
let data = ds.children().find(|n| n.is_element() && n.tag_name().name() == "data");
diff --git a/crates/xfa/src/data/merge.rs b/crates/xfa/src/data/merge.rs
index 48b4cedab..0aefc634b 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<String>) -> 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 = || roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES };
+ let opts = || roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() };
// A packet of an array may use the prefixes the XDP envelope declares: read it inside
// an element declaring the usual ones.
let wrapped;
@@ -389,9 +389,9 @@ pub(super) fn readable(text: &str, within: Within, warnings: &mut Vec<String>) -
warnings.push(format!("The XFA data would be larger than {} MB; it was not written", MAX_PACKET_WRITE >> 20));
return false;
}
- let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES };
- let ok = roxmltree::Document::parse_with_options(text, opts).is_ok()
- || (within == Within::Packet && roxmltree::Document::parse_with_options(&format!("{WRAP_OPEN}{text}{WRAP_CLOSE}"), opts).is_ok());
+ let opts = || roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() };
+ let ok = roxmltree::Document::parse_with_options(text, opts()).is_ok()
+ || (within == Within::Packet && roxmltree::Document::parse_with_options(&format!("{WRAP_OPEN}{text}{WRAP_CLOSE}"), opts()).is_ok());
if !ok {
warnings.push("The XFA data would not be well-formed XML after this change; it was not written".into());
}
diff --git a/crates/xfa/src/data/path.rs b/crates/xfa/src/data/path.rs
index ef61cdbd5..d3568817d 100644
--- a/crates/xfa/src/data/path.rs
+++ b/crates/xfa/src/data/path.rs
@@ -15,7 +15,7 @@ pub fn parse_datasets(xdp: &str) -> Option<DataNode> {
if crate::xml_nesting_depth(xdp) > crate::MAX_XML_DEPTH {
return None;
}
- let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES };
+ let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() };
let doc = roxmltree::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")?;
diff --git a/crates/xfa/src/parse.rs b/crates/xfa/src/parse.rs
index 838d1730e..fc114aeba 100644
--- a/crates/xfa/src/parse.rs
+++ b/crates/xfa/src/parse.rs
@@ -725,7 +725,7 @@ pub fn parse(xml: &str) -> Result<(Template, Vec<String>), XfaError> {
crate::MAX_XML_DEPTH
)));
}
- let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES };
+ let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() };
let doc = roxmltree::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 <template> element too: the one we want is in the
diff --git a/crates/xfa/src/pdf/strip.rs b/crates/xfa/src/pdf/strip.rs
index 2f3084ec9..b75351065 100644
--- a/crates/xfa/src/pdf/strip.rs
+++ b/crates/xfa/src/pdf/strip.rs
@@ -126,7 +126,7 @@ pub fn strip(doc: &mut Document) -> Result<Stripped, XfaError> {
}
// One XDP: the packets it holds are the envelope's children.
let text = s.decoded_within(64 << 20).ok().and_then(|b| crate::packets::decode(&b)).map(|(t, _)| t).unwrap_or_default();
- let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: 1_000_000 };
+ let opts = roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: 1_000_000, ..Default::default() };
if crate::xml_nesting_depth(&text) <= crate::MAX_XML_DEPTH
&& let Ok(parsed) = roxmltree::Document::parse_with_options(&text, opts)
{
diff --git a/crates/xfdf/Cargo.toml b/crates/xfdf/Cargo.toml
index 3ede56503..f868c9571 100644
--- a/crates/xfdf/Cargo.toml
+++ b/crates/xfdf/Cargo.toml
@@ -13,5 +13,5 @@ pdfcraft-cos = { workspace = true }
pdfcraft-annot = { workspace = true }
pdfcraft-forms = { workspace = true }
pdfcraft-model = { workspace = true }
-roxmltree = "0.20"
+roxmltree = "0.21"
thiserror = { workspace = true }
diff --git a/crates/xfdf/src/common.rs b/crates/xfdf/src/common.rs
index c4ac9f600..488277dc1 100644
--- a/crates/xfdf/src/common.rs
+++ b/crates/xfdf/src/common.rs
@@ -86,7 +86,7 @@ pub(crate) fn check_form_xml_depth(text: &str) -> Result<(), DataError> {
}
pub(crate) fn parse_form_xml(text: &str) -> Result<roxmltree::Document<'_>, roxmltree::Error> {
- roxmltree::Document::parse_with_options(text, roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES })
+ roxmltree::Document::parse_with_options(text, roxmltree::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() })
}
pub(crate) const SUBTYPES: [(&str, &str); 17] = [