diff --git a/Cargo.lock b/Cargo.lock index ed58154ab..c5508d7e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1488,7 +1488,7 @@ dependencies = [ [[package]] name = "craft-plist" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0dab3133a2a58d321ade446f23592e7855b79e78#0dab3133a2a58d321ade446f23592e7855b79e78" +source = "git+https://github.com/storytold/craft-libs?rev=902a722422583d051093679985793fb94b2af26e#902a722422583d051093679985793fb94b2af26e" dependencies = [ "thiserror 2.0.21", ] diff --git a/Cargo.toml b/Cargo.toml index bd479a534..31648e7ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ craft-anything-testkit = { path = "crates/testkit" } # external # XML plist reader; prerequisite craft-libs #1633 (repin after merge). -craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "0dab3133a2a58d321ade446f23592e7855b79e78" } +craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "902a722422583d051093679985793fb94b2af26e" } thiserror = "2" serde = { version = "1", features = ["derive", "rc"] } serde_json = "1" diff --git a/crates/formats/src/plist.rs b/crates/formats/src/plist.rs index 43d26ccb8..0a6e261cd 100644 --- a/crates/formats/src/plist.rs +++ b/crates/formats/src/plist.rs @@ -451,11 +451,14 @@ pub fn parse_xml(data: &[u8]) -> Result { // shared reader also charges decoded leaf/key text against this budget. max_expanded_bytes: MAX_EXPANDED_BYTES.max(data.len().saturating_mul(3)), }; - craft_plist::parse_xml_with_limits(data, limits).map(xml_value).map_err(|error| match error { - craft_plist::FormatError::Malformed(message) => FormatError::Malformed(message), - craft_plist::FormatError::Truncated(message) => FormatError::Truncated(message), - craft_plist::FormatError::Unsupported(message) => FormatError::Unsupported(message), - craft_plist::FormatError::TooLarge(message) => FormatError::TooLarge(message), + // The old tokenizer could append at most two tokens after its MAX_NODES check. + craft_plist::parse_xml_with_token_limit(data, limits, craft_plist::XmlOptions::default(), MAX_NODES.saturating_add(2)).map(xml_value).map_err(|error| { + match error { + craft_plist::FormatError::Malformed(message) => FormatError::Malformed(message), + craft_plist::FormatError::Truncated(message) => FormatError::Truncated(message), + craft_plist::FormatError::Unsupported(message) => FormatError::Unsupported(message), + craft_plist::FormatError::TooLarge(message) => FormatError::TooLarge(message), + } }) }