From e20c7c1a6e4dcf2c430da3423f04aad30a4b24a2 Mon Sep 17 00:00:00 2001 From: Afloat Date: Sun, 15 Nov 2026 07:55:30 -0500 Subject: [PATCH] Import binary plist parser changes from Craft Anything 0c386e8a --- crates/plist/src/binary.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/plist/src/binary.rs b/crates/plist/src/binary.rs index 4fb85fd93..26129ad83 100644 --- a/crates/plist/src/binary.rs +++ b/crates/plist/src/binary.rs @@ -82,6 +82,9 @@ fn parse_binary_within(data: &[u8], byte_budget: usize) -> Result { 0x0 => Value::Null, 0x8 => Value::Bool(false), 0x9 => Value::Bool(true), - _ => Value::Null, + _ => return Err(FormatError::Malformed(format!("unknown simple plist object {m:#04x}"))), }, 0x1 => { if lo > 4 { @@ -224,7 +227,7 @@ impl Bin<'_> { }; Value::Real(v.ok_or_else(|| FormatError::Truncated("real".into()))?) } - 0x3 => Value::Date(DateValue::Seconds(self.r.u64_be(at + 1).map(f64::from_bits).ok_or_else(|| FormatError::Truncated("date".into()))?)), + 0x3 if lo == 3 => Value::Date(DateValue::Seconds(self.r.u64_be(at + 1).map(f64::from_bits).ok_or_else(|| FormatError::Truncated("date".into()))?)), 0x4 => { let (n, s) = self.count(at, lo)?; let bytes = self.r.slice(s, n).ok_or_else(|| FormatError::Truncated("data".into()))?; @@ -285,7 +288,7 @@ impl Bin<'_> { let v = self.reference(s, i + n)?; let key = match self.object(k, stack)? { Value::String(s) => s, - other => format!("{:?}", other.to_json()), + _ => return Err(FormatError::Unsupported("non-string dictionary keys cannot be represented in this plist view".into())), }; out.push((key, self.object(v, stack)?)); }