avfilter/vf_mestimate: Check b_count

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 06af6e101b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-06-05 20:04:45 +02:00
parent 4b00aaff68
commit 612d8b0202
1 changed files with 3 additions and 0 deletions

View File

@ -100,6 +100,9 @@ static int config_input(AVFilterLink *inlink)
s->b_height = inlink->h >> s->log2_mb_size; s->b_height = inlink->h >> s->log2_mb_size;
s->b_count = s->b_width * s->b_height; s->b_count = s->b_width * s->b_height;
if (s->b_count == 0)
return AVERROR(EINVAL);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
s->mv_table[i] = av_mallocz_array(s->b_count, sizeof(*s->mv_table[0])); s->mv_table[i] = av_mallocz_array(s->b_count, sizeof(*s->mv_table[0]));
if (!s->mv_table[i]) if (!s->mv_table[i])