avfilter/vf_format: Check pix_fmts before dereferencing it
Fixes CID1224286 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
5ab67340f9
commit
1265247206
@ -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…
x
Reference in New Issue
Block a user