Browse Source

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>
tags/n2.7
Michael Niedermayer 11 years ago
parent
commit
2391e46430
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/mpegvideo.c

+ 2
- 2
libavcodec/mpegvideo.c 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:


Loading…
Cancel
Save