avfilter/vf_format: Check pix_fmts before dereferencing it

Fixes CID1224286

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/76/merge
Michael Niedermayer 11 years ago
parent 5ab67340f9
commit 1265247206
  1. 6
      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++) {

Loading…
Cancel
Save