mirror of
https://github.com/storytold/craft-anything.git
synced 2026-11-29 09:34:12 +01:00
Preserve the XML tokenizer admission budget
This commit is contained in:
1 parent
5cd7341937
commit
5ff2ac9b1a
3 files changed
+10
-7
No files matched your search
Generated
+1
-1
@@ -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",
|
||||
]
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -451,11 +451,14 @@ pub fn parse_xml(data: &[u8]) -> Result<Value, FormatError> {
|
||||
// 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),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user