[MPlayer-dev-eng] bug in demux_mkv

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Jul 15 10:02:52 CEST 2007


Hello,
On Sat, Jul 14, 2007 at 02:26:56PM -0700, Sean D'Epagnier wrote:
> On Sat, Jul 14, 2007 at 11:12:37PM +0200, Aurelien Jacobs wrote:
> > 
> > Could you please make the sample file available somewhere ?
> > 
> 
> http://people.freedesktop.org/~geckosenator/test.mkv
> 
> The file was huge so I cut out just the start of it.  This should
> be enough to see it crash, but not crash with -aid 0.

MPlayer SVN autodetects it just fine, it only crashes if you specify a
stream that does not exist, like -aid 1 or -aid 99.
The problem is that track is check for != NULL right after being used
instead of before.
IMO if no matching track is found, demuxer->audio->id should be set to
-2.
Is attached patch okay (it also remove the useless track == NULL check
in the loop I mentioned above).
I'll have another look, the video selection code might have the same
issue.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/demux_mkv.c
===================================================================
--- libmpdemux/demux_mkv.c	(revision 23784)
+++ libmpdemux/demux_mkv.c	(working copy)
@@ -2520,7 +2520,7 @@
   else if (demuxer->audio->id != -2)  /* -2 = no audio at all */
     track = demux_mkv_find_track_by_num (mkv_d, demuxer->audio->id,
                                          MATROSKA_TRACK_AUDIO);
-  else
+  if (!track)
     {
       mp_msg (MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_MKV_NoAudioTrackFound);
       demuxer->audio->id = -2;
@@ -2534,7 +2534,7 @@
           continue;
       if(demuxer->a_streams[track->tnum])
         {
-          if(track && mkv_d->tracks[i] == track)
+          if(mkv_d->tracks[i] == track)
             {
               demuxer->audio->id = track->tnum;
               demuxer->audio->sh = demuxer->a_streams[track->tnum];


More information about the MPlayer-dev-eng mailing list