diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-07-01 15:41:29 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-07-01 15:42:07 +0200 |
commit | ac78014f0b1f219a596d3c0cd803cf6b84191886 (patch) | |
tree | 3fe65883c4c0a2e022addc328476832b27a54254 /libavcodec/motion_est.c | |
parent | f91126643a91c2d3f8d8e210c8facaf259951b03 (diff) | |
download | ffmpeg-ac78014f0b1f219a596d3c0cd803cf6b84191886.tar.gz |
avcodec/motion_est: Fix some undefined shifts
Fixes: asan_heap-oob_1dd60fd_1049_cov_4200102444_P4250048.MOV
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r-- | libavcodec/motion_est.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 9e184df74a..477a6827ce 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -426,13 +426,13 @@ static int sad_hpel_motion_search(MpegEncContext * s, my > ymin && my < ymax) { int dx=0, dy=0; int d, pen_x, pen_y; - const int index= (my<<ME_MAP_SHIFT) + mx; + const int index= my*(1<<ME_MAP_SHIFT) + mx; const int t= score_map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)]; const int l= score_map[(index- 1 )&(ME_MAP_SIZE-1)]; const int r= score_map[(index+ 1 )&(ME_MAP_SIZE-1)]; const int b= score_map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)]; - mx<<=1; - my<<=1; + mx += mx; + my += my; pen_x= pred_x + mx; @@ -490,8 +490,8 @@ static int sad_hpel_motion_search(MpegEncContext * s, my+=dy; }else{ - mx<<=1; - my<<=1; + mx += mx; + my += my; } *mx_ptr = mx; |