[vlc-devel] [PATCH] Prevents a crash if KaxInfo cannot be found in KaxSegment

Denis Charmet typx at dinauz.org
Wed Nov 23 23:36:26 CET 2011


---
 modules/demux/mkv/demux.cpp |    4 ++--
 modules/demux/mkv/mkv.cpp   |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index 6ebcaef..c7bdc11 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -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++ )
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 9f4b981..b81b11f 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -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 );
-- 
1.7.7.1




More information about the vlc-devel mailing list