[vlc-devel] [PATCH] Don't crash when loading a directory with no uid MKV files

y at dinauz.org y at dinauz.org
Sun Apr 8 02:14:03 CEST 2012


From: Denis Charmet <typx at dinauz.org>

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

diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index f68dde5..d863bb7 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -554,7 +554,7 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
                     break;
                 }
             }
-            if ( b_keep_segment )
+            if ( b_keep_segment || !p_segment1->p_segment_uid )
             {
                 b_keep_stream = true;
                 p_stream1->segments.push_back( p_segment1 );
@@ -746,7 +746,7 @@ matroska_segment_c *demux_sys_t::FindSegment( const EbmlBinary & uid ) const
 {
     for (size_t i=0; i<opened_segments.size(); i++)
     {
-        if ( *opened_segments[i]->p_segment_uid == uid )
+        if ( opened_segments[i]->p_segment_uid && *opened_segments[i]->p_segment_uid == uid )
             return opened_segments[i];
     }
     return NULL;
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 9892b7c..682b552 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -31,7 +31,8 @@ matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vector<matrosk
 {
     for( size_t i = 0; i < (*segments).size(); i++ )
     {
-        if( *p_uid == *((*segments)[i]->p_segment_uid) )
+        if( (*segments)[i]->p_segment_uid &&
+            *p_uid == *((*segments)[i]->p_segment_uid) )
             return (*segments)[i];
     }
     return NULL;
-- 
1.7.9.5




More information about the vlc-devel mailing list