[MPlayer-dev-eng] Fix NULL pointer dereference when audio filter fails

Lasse Kärkkäinen tronic at trn.iki.fi
Sun Apr 20 10:36:12 CEST 2008


sh_audio->afilter being NULL will cause segfault in the playback loop.
Workaround by setting sh_audio and d_audio->sh to NULL if the afilter
init fails, so that audio decoding is disabled entirely.

Index: mplayer.c
===================================================================
--- mplayer.c	(revision 26472)
+++ mplayer.c	(working copy)
@@ -1636,6 +1636,8 @@
 //      mp_msg(MSGT_CPLAYER,MSGL_ERR,"Couldn't find matching filter /
ao format! -> NOSOUND\n");
 //      uninit_player(INITIALIZED_ACODEC|INITIALIZED_AO); // close
codec & ao
 //      sh_audio=mpctx->d_audio->sh=NULL; // -> nosound
+      // FIXME: Possible leak: should something be uninitialized first?
+      mpctx->sh_audio=mpctx->d_audio->sh=NULL; // failed to init :(
     }
 #endif
   }



More information about the MPlayer-dev-eng mailing list