[FFmpeg-devel] [PATCH 1/3] ffmpeg: fix a crash with complex filters when pix_fmt is not specified
Nicolas George
nicolas.george at normalesup.org
Thu May 3 15:09:14 CEST 2012
Le quintidi 15 floréal, an CCXX, Matthieu Bouron a écrit :
> ---
> ffmpeg.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Can you say in a few words under what circumstances that happens? No
-pix_fmt seems a necessary condition, but ost->enc should not be NULL
either.
>
> diff --git a/ffmpeg.c b/ffmpeg.c
> index f395a44..64ee5fd 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -707,10 +707,12 @@ static enum PixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum Pixe
>
> static const enum PixelFormat *choose_pixel_fmts(OutputStream *ost)
> {
> + enum PixelFormat *enc_pix_fmts = ost->enc ? ost->enc->pix_fmts : NULL;
> +
> if (ost->st->codec->pix_fmt != PIX_FMT_NONE) {
> ost->pix_fmts[0] = choose_pixel_fmt(ost->st, ost->enc, ost->st->codec->pix_fmt);
> return ost->pix_fmts;
> - } else if (ost->enc->pix_fmts) {
> + } else if (enc_pix_fmts) {
This could be written "if (ost->enc && ost->enc->pix_fmts)". I do not know
if it is better.
> if (ost->st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
> if (ost->st->codec->codec_id == CODEC_ID_MJPEG) {
> return (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE };
> --
> 1.7.10
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120503/cb847e89/attachment.asc>
More information about the ffmpeg-devel
mailing list