From 2391e46430fa2af28542124dbcfc935c0a5ce82c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 11 Mar 2015 17:59:59 +0100 Subject: [PATCH] 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 Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 64ee632e59..1f2fc1b556 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -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]<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)<> 6; return FFMIN(FFMAX(s->mb_y + off, 0), s->mb_height-1); unhandled: