Prevents a crash if KaxInfo cannot be found in KaxSegment
authorDenis Charmet <typx@dinauz.org>
Wed, 23 Nov 2011 22:36:26 +0000 (23:36 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 23 Nov 2011 22:49:29 +0000 (23:49 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/demux/mkv/demux.cpp
modules/demux/mkv/mkv.cpp

index a8c8aa4..83edcb7 100644 (file)
@@ -460,7 +460,7 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
 {
     int i_upper_lvl = 0;
     EbmlElement *p_l0, *p_l1, *p_l2;
-    bool b_keep_stream = false, b_keep_segment;
+    bool b_keep_stream = false, b_keep_segment = false;
 
     // verify the EBML Header
     p_l0 = p_estream->FindNextID(EBML_INFO(EbmlHead), 0xFFFFFFFFL);
@@ -505,7 +505,6 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
         {
             EbmlParser  *ep;
             matroska_segment_c *p_segment1 = new matroska_segment_c( *this, *p_estream );
-            b_keep_segment = b_initial;
 
             ep = new EbmlParser(p_estream, p_l0, &demuxer );
             p_segment1->ep = ep;
@@ -517,6 +516,7 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
                 {
                     // find the families of this segment
                     KaxInfo *p_info = static_cast<KaxInfo*>(p_l1);
+                    b_keep_segment = b_initial;
 
                     p_info->Read(*p_estream, EBML_CLASS_CONTEXT(KaxInfo), i_upper_lvl, p_l2, true);
                     for( size_t i = 0; i < p_info->ListSize(); i++ )
index 16d6b7d..a350a43 100644 (file)
@@ -119,7 +119,7 @@ static int Open( vlc_object_t * p_this )
     p_stream = p_sys->AnalyseAllSegmentsFound( p_demux, p_io_stream, true );
     if( p_stream == NULL )
     {
-        msg_Err( p_demux, "cannot find KaxSegment" );
+        msg_Err( p_demux, "cannot find KaxSegment or missing mandatory KaxInfo" );
         goto error;
     }
     p_sys->streams.push_back( p_stream );