QT/MP4 reader: ignore obviously wrong sample size entries

This commit is contained in:
Moritz Bunkus 2013-11-24 21:00:44 +01:00
parent 8dc4d4c6de
commit 42e5f91c3e
2 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2013-11-24 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: improved resilience against MP4 files with
obviously wrong entries in the 'sample size table' (STSZ) atom.
* mkvmerge: bug fix: improved VC1 frame type detection so that it
works even for streams without entry points.

View File

@ -950,6 +950,12 @@ qtmp4_reader_c::handle_stsz_atom(qtmp4_demuxer_cptr &new_dmx,
qt_sample_t sample;
sample.size = m_in->read_uint32_be();
// This is a sanity check against damaged samples. I have one of
// those in which one sample was suppposed to be > 2GB big.
if (sample.size >= 100 * 1024 * 1024)
sample.size = 0;
new_dmx->sample_table.push_back(sample);
}
@ -1912,6 +1918,7 @@ qtmp4_demuxer_c::build_index() {
void
qtmp4_demuxer_c::build_index_constant_sample_size_mode() {
mxinfo(boost::format("CONST mode\n"));
size_t keyframe_table_idx = 0;
size_t keyframe_table_size = keyframe_table.size();
@ -1949,6 +1956,7 @@ qtmp4_demuxer_c::build_index_constant_sample_size_mode() {
void
qtmp4_demuxer_c::build_index_chunk_mode() {
mxinfo(boost::format("CHUNK mode\n"));
size_t keyframe_table_idx = 0;
size_t keyframe_table_size = keyframe_table.size();