[FFmpeg-devel] [PATCH 6/9] avfilter/vf_premultiply: make sure plane count is less than 4

Timo Rothenpieler timo at rothenpieler.org
Wed Nov 8 20:17:50 EET 2017


Fixes CID #1416350, #1416351, #1416353 and #1416354
---
 libavfilter/vf_premultiply.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index 5120adc476..1af6433bc9 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -476,7 +476,7 @@ static int filter_frame(AVFilterContext *ctx,
             }
         }
 
-        for (p = 0; p < s->nb_planes; p++) {
+        for (p = 0; p < s->nb_planes && p < 4; p++) {
             if (!((1 << p) & s->planes) || p == 3) {
                 av_image_copy_plane((*out)->data[p], (*out)->linesize[p], base->data[p], base->linesize[p],
                                     s->linesize[p], s->height[p]);
@@ -523,6 +523,8 @@ static int config_input(AVFilterLink *inlink)
     int vsub, hsub, ret;
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
+    if (s->nb_planes > 4)
+        return AVERROR_BUG;
 
     if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
         return ret;
-- 
2.14.2



More information about the ffmpeg-devel mailing list