[vlc-devel] [PATCH 07/10] demux:mkv: do not write audio/video elements in a mismatched track

Steve Lhomme robux4 at videolabs.io
Fri Jul 7 12:56:15 CEST 2017


It will overwrite values in the es_format_t union incorrectly.
---
 modules/demux/mkv/matroska_segment_parse.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index e74cb34787..51968028a4 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -514,6 +514,9 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
 
             mkv_track_t *tk = vars.tk;
 
+            if (tk->fmt.i_cat != VIDEO_ES ) {
+                msg_Err( vars.p_demuxer, "Video elements not allowed for this track" );
+            } else {
             tk->f_fps = 0.0;
 
             if( tk->i_default_duration > 1000 ) /* Broken ffmpeg mux info when non set fps */
@@ -553,6 +556,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             }
             /* FIXME: i_display_* allows you to not only set DAR, but also a zoom factor.
                we do not support this atm */
+            }
         }
 #if LIBMATROSKA_VERSION >= 0x010406
         E_CASE( KaxVideoProjection, proj )
@@ -672,10 +676,13 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         }
         E_CASE( KaxTrackAudio, tka ) {
             debug( vars, "Track Audio");
-
+            if (vars.tk->fmt.i_cat != AUDIO_ES ) {
+                msg_Err( vars.p_demuxer, "Audio elements not allowed for this track" );
+            } else {
             vars.level += 1;
             dispatcher.iterate( tka.begin(), tka.end(), Payload( vars ));
             vars.level -= 1;
+            }
         }
         E_CASE( KaxAudioSamplingFreq, afreq )
         {
-- 
2.12.1



More information about the vlc-devel mailing list