On 2012-12-07 12:45:03 +0200, Martin Storsjö wrote: > When called from the v4l2 input device, pix_fmt can be > AV_PIX_FMT_NONE (for jpeg formats). Before 50ba57e0, this wasn't > an issue for avpicture_get_size, but after that commit, this > lead to crashes. > --- > Alternative approach as suggested by Janne. > > libavcodec/avpicture.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavcodec/avpicture.c b/libavcodec/avpicture.c > index ec4e748..259fd8e 100644 > --- a/libavcodec/avpicture.c > +++ b/libavcodec/avpicture.c > @@ -88,6 +88,8 @@ int avpicture_get_size(enum AVPixelFormat pix_fmt, int > width, int height) > AVPicture dummy_pict; > int ret; > > + if (!desc) > + return AVERROR(EINVAL); > if ((ret = av_image_check_size(width, height, 0, NULL)) < 0) > return ret; > if (desc->flags & PIX_FMT_PSEUDOPAL)
I prefer this. It makes little sense to continue if we already know that it will just return an error later. Patch ok for me. Janne _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel