[MPlayer-cvslog] r38152 - trunk/libmpdemux/demux_lavf.c

reimar subversion at mplayerhq.hu
Fri Sep 27 10:29:08 EEST 2019


Author: reimar
Date: Fri Sep 27 10:29:07 2019
New Revision: 38152

Log:
demux_lavf: sanity-check stream ID before using it.

ds->id may have been initialized via -vid option to
a value that does not correspond to a currently
existing stream.
Thus check that it's valid before using it.
Fixes crash when playing mp4 files and
specifying e.g. -vid 7777.
Reported by Raad Haddad (raadfhaddad at gmail)

Modified:
   trunk/libmpdemux/demux_lavf.c

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Thu Aug 22 17:49:27 2019	(r38151)
+++ trunk/libmpdemux/demux_lavf.c	Fri Sep 27 10:29:07 2019	(r38152)
@@ -839,7 +839,7 @@ static int demux_lavf_control(demuxer_t
 	    else
 	    {
 	        ds_free_packs(ds);
-	        if(ds->id >= 0)
+	        if(ds->id >= 0 && ds->id < nstreams)
 	            priv->avfc->streams[ds->id]->discard = AVDISCARD_ALL;
 	        *((int*)arg) = ds->id = newid;
 	        if(newid >= 0)


More information about the MPlayer-cvslog mailing list