Skip to content

Commit feb05eb

Browse files
committed
fix decode null
1 parent a1a6f63 commit feb05eb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

crates/amf0/src/de/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ where
146146
Amf0Marker::String | Amf0Marker::LongString | Amf0Marker::XmlDocument => {
147147
self.decode_string()?.into_deserializer().deserialize_any(visitor)
148148
}
149-
Amf0Marker::Null | Amf0Marker::Undefined => visitor.visit_unit(),
149+
Amf0Marker::Null | Amf0Marker::Undefined => {
150+
self.decode_null()?;
151+
visitor.visit_unit()
152+
},
150153
Amf0Marker::Object | Amf0Marker::TypedObject | Amf0Marker::EcmaArray => {
151154
let header = self.decode_object_header()?;
152155
match header {

crates/amf0/src/encoder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ where
112112
}
113113

114114
pub(crate) fn encode_object_trailer(&mut self) -> Result<(), Amf0Error> {
115-
self.writer.write_u24::<BigEndian>(Amf0Marker::ObjectEnd as u32)?;
115+
// Final object key length is 0
116+
self.writer.write_u16::<BigEndian>(0)?;
117+
// Followed by object end
118+
self.writer.write_u8(Amf0Marker::ObjectEnd as u8)?;
116119
Ok(())
117120
}
118121

0 commit comments

Comments
 (0)