avfilter/drawutils: Fix format validity check in ff_draw_init()

Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-06-13 00:06:28 +02:00
parent ea37df2d52
commit e0db41316a

View File

@ -160,7 +160,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
unsigned i, nb_planes = 0;
int pixelstep[MAX_PLANES] = { 0 };
if (!desc->name)
if (!desc || !desc->name)
return AVERROR(EINVAL);
if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL | AV_PIX_FMT_FLAG_ALPHA))
return AVERROR(ENOSYS);