[Ffmpeg-devel] [PATCH] fix ffmpeg crash when thread_count is zero

Michael Niedermayer michaelni
Tue Feb 27 23:53:28 CET 2007


Hi

On Tue, Feb 27, 2007 at 07:21:09PM +0800, Limin Wang wrote:
> Hi,
> 
> After inputing "-threads auto" option for ffmpeg as x264, mencode by mistaken.
> I got ffmpeg crashed. After checking, I got the reason is ffmpeg get
> thread_count to zero in case of this usage. 
> 
> The attached patch will check and restrict the thread_count range from 1 to
> FF_THREAD_MAX. Maybe it's better to support auto option like x264?
> 
> 
> Thanks,
> Limin

> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 8140)
> +++ ffmpeg.c	(working copy)
> @@ -2323,6 +2323,8 @@
>  static void opt_thread_count(const char *arg)
>  {
>      thread_count= atoi(arg);
> +
> +    thread_count = av_clip( thread_count, 1, FF_THREAD_MAX );

ffmpeg should fail if the value is invalid


[....]

>  
> +#define FF_THREAD_MAX 16

why?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070227/213f0cba/attachment.pgp>



More information about the ffmpeg-devel mailing list