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

Denis Charmet git at videolan.org
Sun Apr 8 20:06:24 CEST 2012


vlc/vlc-2.0 | branch: master | Denis Charmet <typx at dinauz.org> | Sun Apr  8 02:14:03 2012 +0200| [53d47cab1315f664601f081ab3c641e86cf5e241] | committer: Jean-Baptiste Kempf

MKV: Don't crash when loading a directory with no uid MKV files

Close #6575

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 4599e6a4491fce5a8ae3377e601ab3aa258d33e4)

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

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=53d47cab1315f664601f081ab3c641e86cf5e241
---

 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;



More information about the vlc-commits mailing list