Skip to content

Commit

Permalink
Fix MoreDataNeeded containing the wrong size
Browse files Browse the repository at this point in the history
  • Loading branch information
FreezyLemon authored and Luni-4 committed May 15, 2023
1 parent 7f15b7c commit 04b86b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/demuxer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,12 @@ impl Demuxer for MkvDemuxer {
Ok((seek, Event::MoreDataNeeded(0)))
}
Err(Err::Incomplete(Needed::Size(size))) => {
Err(Error::MoreDataNeeded(usize::from(size)))
// Needed::Size(size) describes only the missing number of bytes,
// but Error::MoreDataNeeded(size) wants the entire size of the Element.
Err(Error::MoreDataNeeded(buf.data().len() + size.get()))
}
e => {
error!("{:?}", e);
error!("{e:?}");
Err(Error::InvalidData)
}
}
Expand Down

0 comments on commit 04b86b9

Please sign in to comment.