[FFmpeg-cvslog] avfilter/vf_waveform: better guard against picking wrong pixel format

Paul B Mahol git at videolan.org
Fri Oct 11 13:10:06 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Oct 11 12:07:10 2019 +0200| [7ad69a73f3d9d0e4575ef40e746a974989b3d3eb] | committer: Paul B Mahol

avfilter/vf_waveform: better guard against picking wrong pixel format

Fixes #8252

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ad69a73f3d9d0e4575ef40e746a974989b3d3eb
---

 libavfilter/vf_waveform.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index 8033628407..fe2fc76359 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -290,9 +290,9 @@ static int query_formats(AVFilterContext *ctx)
     WaveformContext *s = ctx->priv;
     const enum AVPixelFormat *out_pix_fmts;
     const enum AVPixelFormat *in_pix_fmts;
-    const AVPixFmtDescriptor *desc;
-    AVFilterFormats *avff;
-    int depth, rgb, i, ret, ncomp;
+    const AVPixFmtDescriptor *desc, *desc2;
+    AVFilterFormats *avff, *avff2;
+    int depth, depth2, rgb, i, ret, ncomp, ncomp2;
 
     if (!ctx->inputs[0]->in_formats ||
         !ctx->inputs[0]->in_formats->nb_formats) {
@@ -316,10 +316,16 @@ static int query_formats(AVFilterContext *ctx)
     }
 
     avff = ctx->inputs[0]->in_formats;
+    avff2 = ctx->inputs[0]->out_formats;
     desc = av_pix_fmt_desc_get(avff->formats[0]);
+    desc2 = av_pix_fmt_desc_get(avff2->formats[0]);
     ncomp = desc->nb_components;
+    ncomp2 = desc2->nb_components;
     rgb = desc->flags & AV_PIX_FMT_FLAG_RGB;
     depth = desc->comp[0].depth;
+    depth2 = desc2->comp[0].depth;
+    if (ncomp != ncomp2 || depth != depth2)
+        return AVERROR(EAGAIN);
     for (i = 1; i < avff->nb_formats; i++) {
         desc = av_pix_fmt_desc_get(avff->formats[i]);
         if (rgb != (desc->flags & AV_PIX_FMT_FLAG_RGB) ||



More information about the ffmpeg-cvslog mailing list