1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00

avcodec/mpegvideo: Fix undefined shift in ff_mpv_lowest_referenced_row()

Also moves the shift out of the inner loop

Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-03-11 17:59:59 +01:00
parent 9b2a964cee
commit 2391e46430

View File

@ -2952,12 +2952,12 @@ int ff_mpv_lowest_referenced_row(MpegEncContext *s, int dir)
}
for (i = 0; i < mvs; i++) {
my = s->mv[dir][i][1]<<qpel_shift;
my = s->mv[dir][i][1];
my_max = FFMAX(my_max, my);
my_min = FFMIN(my_min, my);
}
off = (FFMAX(-my_min, my_max) + 63) >> 6;
off = ((FFMAX(-my_min, my_max)<<qpel_shift) + 63) >> 6;
return FFMIN(FFMAX(s->mb_y + off, 0), s->mb_height-1);
unhandled: