[FFmpeg-cvslog] avfilter/vf_mestimate: Check b_count

Michael Niedermayer git at videolan.org
Wed Sep 8 22:43:17 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jun  5 20:04:45 2021 +0200| [433d93a3b61b2a40c2f0b89fcd24303bc068d05f] | committer: Michael Niedermayer

avfilter/vf_mestimate: Check b_count

Fixes: left shift of negative value -1
Fixes: Ticket8270

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 06af6e101bbd04e8ecc5337bc3b6894a5e058e14)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavfilter/vf_mestimate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/vf_mestimate.c b/libavfilter/vf_mestimate.c
index 7ecfe7da60..9a2865a0cb 100644
--- a/libavfilter/vf_mestimate.c
+++ b/libavfilter/vf_mestimate.c
@@ -100,6 +100,9 @@ static int config_input(AVFilterLink *inlink)
     s->b_height = inlink->h >> s->log2_mb_size;
     s->b_count = s->b_width * s->b_height;
 
+    if (s->b_count == 0)
+        return AVERROR(EINVAL);
+
     for (i = 0; i < 3; i++) {
         s->mv_table[i] = av_mallocz_array(s->b_count, sizeof(*s->mv_table[0]));
         if (!s->mv_table[i])



More information about the ffmpeg-cvslog mailing list