Commit 12652472 authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/vf_format: Check pix_fmts before dereferencing it

Fixes CID1224286
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 5ab67340
...@@ -60,6 +60,9 @@ static av_cold int init(AVFilterContext *ctx) ...@@ -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) ...@@ -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++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment