[FFmpeg-cvslog] avcodec/mpegvideo: Fix undefined shift in ff_mpv_lowest_referenced_row()

Michael Niedermayer git at videolan.org
Wed Mar 11 18:18:03 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Mar 11 17:59:59 2015 +0100| [2391e46430fa2af28542124dbcfc935c0a5ce82c] | committer: Michael Niedermayer

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 at google.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mpegvideo.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 64ee632..1f2fc1b 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]<<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:



More information about the ffmpeg-cvslog mailing list