flv: Script data blocks appear to start with a trash byte `0x02`

This commit is contained in:
David Wendt 2023-04-18 19:02:34 -04:00 committed by kmeisthax
parent 6358d3162b
commit 4f831b4351
2 changed files with 3 additions and 2 deletions

View File

@ -127,6 +127,7 @@ impl<'a> ScriptData<'a> {
/// No data size parameter is accepted; we parse until we reach an object
/// terminator, reach invalid data, or we run out of bytes in the reader.
pub fn parse(reader: &mut FlvReader<'a>) -> Option<Self> {
let _trash = reader.read_u8()?;
let mut vars = vec![];
loop {
@ -369,7 +370,7 @@ mod tests {
#[test]
fn read_scriptdata() {
let data = [
0x00, 0x03, 0x01, 0x02, 0x03, 0x06, 0x00, 0x03, 0x01, 0x02, 0x03, 0x05, 0x00, 0x00,
0x02, 0x00, 0x03, 0x01, 0x02, 0x03, 0x06, 0x00, 0x03, 0x01, 0x02, 0x03, 0x05, 0x00, 0x00,
0x09,
];
let mut reader = FlvReader::from_source(&data);

View File

@ -157,7 +157,7 @@ mod tests {
fn read_tag_scriptdata() {
let data = [
0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
0x00, 0x00, 0x03, 0x01, 0x02, 0x03, 0x06, 0x00, 0x03, 0x01, 0x02, 0x03, 0x05, 0x00,
0x00, 0x02, 0x00, 0x03, 0x01, 0x02, 0x03, 0x06, 0x00, 0x03, 0x01, 0x02, 0x03, 0x05, 0x00,
0x00, 0x09,
];
let mut reader = FlvReader::from_source(&data);