[FFmpeg-devel] [PATCH] fix possible crash if vpre before vcodec

Michael Niedermayer michaelni
Fri Feb 27 13:06:48 CET 2009

On Fri, Feb 27, 2009 at 11:25:26AM +0100, Reimar D?ffinger wrote:
> Hello,
> I recently tried the following command
> ffmpeg -i baldursgate-logo.mve -vpre hq -vcodec libx264 -b 500k -an out.mp4
> and wondered why it would not work.
> strace showed the following:
> open("/home/reimar/.ffmpeg/hq.ffpreset", O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/home/reimar/.ffmpeg/(null)-hq.ffpreset", O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/usr/local/share/ffmpeg/hq.ffpreset", O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/usr/local/share/ffmpeg/(null)-hq.ffpreset", O_RDONLY) = -1 ENOENT (No such file or directory)
> obviously ffmpeg tries to open the file already during option parsing (this could probably be considered
> the real bug). When -vcodec is set only afterwards it passes NULL to
> snprintf %s argument which may (and will) crash with some
> implementations.
> I propose a patch that at least avoids the crash, but e.g. this:
> -vcodec blub -vpre hq -vcodec libx264
> will still have the counter-intuitive behaviour of reading
> blub-hq.ffpreset but encoding with libx264.

would it not make more sense to warn the user that the codec is not set
before -*pre instead of silently skiping searching for the file?

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090227/9efc2567/attachment.pgp>

More information about the ffmpeg-devel mailing list