Browse Source

avfilter/vf_format: Check pix_fmts before dereferencing it

Fixes CID1224286

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.3
Michael Niedermayer 11 years ago
parent
commit
1265247206
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      libavfilter/vf_format.c

+ 3
- 3
libavfilter/vf_format.c View File

@@ -60,6 +60,9 @@ static av_cold int init(AVFilterContext *ctx)
int i; int i;
int ret; int ret;


if (!s->pix_fmts)
return AVERROR(EINVAL);

/* count the formats */ /* count the formats */
cur = s->pix_fmts; cur = s->pix_fmts;
while ((cur = strchr(cur, '|'))) { while ((cur = strchr(cur, '|'))) {
@@ -72,9 +75,6 @@ static av_cold int init(AVFilterContext *ctx)
if (!s->formats) if (!s->formats)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);


if (!s->pix_fmts)
return AVERROR(EINVAL);

/* parse the list of formats */ /* parse the list of formats */
cur = s->pix_fmts; cur = s->pix_fmts;
for (i = 0; i < nb_formats; i++) { for (i = 0; i < nb_formats; i++) {


Loading…
Cancel
Save