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

Meihui Fan mhfan at hhcn.com
Sun Apr 20 11:10:26 CEST 2008


Hi,

I've found this bug a few days ago.
I also dug into it and got a real fix.

Attached is my patch.

Lasse Kärkkäinen wrote:
> 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
>    }
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
> 

-- 
Best Regards,
范美辉 (Meihui Fan)
Chief Engineer
Software Engineering Department
Tel: +86-551-5333155/156/157,5325173
FAX: +86-551-5325323
Products Info. : http://www.hhcn.com
Tech. Support  : http://bbs.hhcn.com
HHTech : An Embedded Linux Tech. Provider in Mainland China

-------------- next part --------------
A non-text attachment was scrubbed...
Name: af-fail-free.diff
Type: text/x-diff
Size: 322 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20080420/dc9009d4/attachment.diff>


More information about the MPlayer-dev-eng mailing list