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

Denis Charmet git at videolan.org
Wed Nov 23 23:49:35 CET 2011


vlc | branch: master | Denis Charmet <typx at dinauz.org> | Wed Nov 23 23:36:26 2011 +0100| [289d5a7295e33f8f4955783270b0b86f6b805510] | committer: Jean-Baptiste Kempf

Prevents a crash if KaxInfo cannot be found in KaxSegment

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=289d5a7295e33f8f4955783270b0b86f6b805510
---

 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 a8c8aa4..83edcb7 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 16d6b7d..a350a43 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 );



More information about the vlc-commits mailing list