From 126524720661a9adddec758e94729007a96f07f7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 3 Jul 2014 02:05:34 +0200 Subject: [PATCH] avfilter/vf_format: Check pix_fmts before dereferencing it Fixes CID1224286 Signed-off-by: Michael Niedermayer --- libavfilter/vf_format.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index afa17fe8a2..13b41e4663 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -60,6 +60,9 @@ static av_cold int init(AVFilterContext *ctx) int i; int ret; + if (!s->pix_fmts) + return AVERROR(EINVAL); + /* count the formats */ cur = s->pix_fmts; while ((cur = strchr(cur, '|'))) { @@ -72,9 +75,6 @@ static av_cold int init(AVFilterContext *ctx) if (!s->formats) return AVERROR(ENOMEM); - if (!s->pix_fmts) - return AVERROR(EINVAL); - /* parse the list of formats */ cur = s->pix_fmts; for (i = 0; i < nb_formats; i++) {