Skip to content

Commit 04b86b9

Browse files
FreezyLemonLuni-4
authored andcommitted
Fix MoreDataNeeded containing the wrong size
1 parent 7f15b7c commit 04b86b9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/demuxer.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,12 @@ impl Demuxer for MkvDemuxer {
173173
Ok((seek, Event::MoreDataNeeded(0)))
174174
}
175175
Err(Err::Incomplete(Needed::Size(size))) => {
176-
Err(Error::MoreDataNeeded(usize::from(size)))
176+
// Needed::Size(size) describes only the missing number of bytes,
177+
// but Error::MoreDataNeeded(size) wants the entire size of the Element.
178+
Err(Error::MoreDataNeeded(buf.data().len() + size.get()))
177179
}
178180
e => {
179-
error!("{:?}", e);
181+
error!("{e:?}");
180182
Err(Error::InvalidData)
181183
}
182184
}

0 commit comments

Comments
 (0)