History

avfilter/vf_waveform: better guard against picking wrong pixel format

Fixes #8252

Paul B Mahol committed 7 years ago

Commit 7ad69a71 parent e787f8f1 file · +9 −3Browse files

Unified · Split

libavfilter/vf_waveform.c+9−3
@@ -290,9 +290,9 @@ static int query_formats(AVFilterContext *ctx) · 289 unmodified lines
290290 WaveformContext *s = ctx->priv;
291291 const enum AVPixelFormat *out_pix_fmts;
292292 const enum AVPixelFormat *in_pix_fmts;
293− const AVPixFmtDescriptor *desc;
294− AVFilterFormats *avff;
295− int depth, rgb, i, ret, ncomp;
293+ const AVPixFmtDescriptor *desc, *desc2;
294+ AVFilterFormats *avff, *avff2;
295+ int depth, depth2, rgb, i, ret, ncomp, ncomp2;
296296
297297 if (!ctx->inputs[0]->in_formats ||
298298 !ctx->inputs[0]->in_formats->nb_formats) {
@@ -316,10 +316,16 @@ static int query_formats(AVFilterContext *ctx) · 17 unmodified lines
316316 }
317317
318318 avff = ctx->inputs[0]->in_formats;
319+ avff2 = ctx->inputs[0]->out_formats;
319320 desc = av_pix_fmt_desc_get(avff->formats[0]);
321+ desc2 = av_pix_fmt_desc_get(avff2->formats[0]);
320322 ncomp = desc->nb_components;
323+ ncomp2 = desc2->nb_components;
321324 rgb = desc->flags & AV_PIX_FMT_FLAG_RGB;
322325 depth = desc->comp[0].depth;
326+ depth2 = desc2->comp[0].depth;
327+ if (ncomp != ncomp2 || depth != depth2)
328+ return AVERROR(EAGAIN);
323329 for (i = 1; i < avff->nb_formats; i++) {
324330 desc = av_pix_fmt_desc_get(avff->formats[i]);
325331 if (rgb != (desc->flags & AV_PIX_FMT_FLAG_RGB) ||

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t