[vlc-devel] [PATCH 18/20] mkv: Added error diagnostic if i_track does not match seekpoint

Filip Roséen filip at videolabs.io
Fri Mar 4 17:04:16 CET 2016


Added an if-check to make sure that we do not crash on the lines that
follow if we, for some reason, end up in a state where there is no
matching seekpoint for the specified `i_track`.
---
 modules/demux/mkv/matroska_segment.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index c2e534c..8a19b70 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -990,6 +990,11 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
                         if (it->i_track == i_track)
                             break;
 
+                    if (unlikely (it == spoints.end ()) ) {
+                        msg_Err( &sys.demuxer, "Unable to locate seekpoint using i_track = %zu!", i_track);
+                        return;
+                    }
+
                     it->i_mk_date = i_mk_pts;
                     if( simpleblock )
                         it->i_seek_pos = simpleblock->GetElementPosition();
-- 
2.7.2



More information about the vlc-devel mailing list