1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/vf_format: Check pix_fmts before dereferencing it

Fixes CID1224286

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-07-03 02:05:34 +02:00
parent 5ab67340f9
commit 1265247206

View File

@ -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++) {