[vlc-devel] [PATCH] Fix a bug preventing files without segment duration and

Denis Charmet typx at dinauz.org
Tue Nov 1 15:42:43 CET 2011


Fix the crash of http://streams.videolan.org/issues/mkv/invalid_EBML_number_size_tag.mkv
---
 modules/demux/mkv/demux.cpp           |    2 ++
 modules/demux/mkv/virtual_segment.cpp |    4 +++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index ac399d4..6ebcaef 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -697,6 +697,8 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c *p_new_segment )
         p_current_segment = p_new_segment;
         i_current_title = p_new_segment->i_sys_title;
     }
+    if( !p_current_segment->CurrentSegment() )
+        return false;
     if( !p_current_segment->CurrentSegment()->b_cues )
         msg_Warn( &p_current_segment->CurrentSegment()->sys.demuxer, "no cues/empty cues found->seek won't be precise" );
 
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 7f7e191..ccd462f 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -351,7 +351,9 @@ virtual_chapter_c* virtual_edition_c::getChapterbyTimecode( int64_t time )
 {
     for( size_t i = 0; i < chapters.size(); i++ )
     {
-        if( time >= chapters[i]->i_virtual_start_time && time < chapters[i]->i_virtual_stop_time )
+        if( time >= chapters[i]->i_virtual_start_time &&
+            ( chapters[i]->i_virtual_stop_time < 0 || time < chapters[i]->i_virtual_stop_time ) )
+            /*with the current implementation only the last chapter can have a negative virtual_stop_time*/
             return chapters[i]->getSubChapterbyTimecode( time );
     }
 
-- 
1.7.7.1




More information about the vlc-devel mailing list