[FFmpeg-cvslog] avcodec/vc1_pred: Fix invalid shifts in scaleforopp()

Michael Niedermayer git at videolan.org
Sat Sep 28 20:24:28 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Sep 10 18:57:25 2019 +0200| [ced9a1cd0ab76a65e509b0d7c56965d61ea1df84] | committer: Michael Niedermayer

avcodec/vc1_pred: Fix invalid shifts in scaleforopp()

Fixes: left shift of negative value -2
Fixes: 16964/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5757853565976576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
index e1ad0e1d7d..f70956e739 100644
--- a/libavcodec/vc1_pred.c
+++ b/libavcodec/vc1_pred.c
@@ -191,9 +191,9 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
     n >>= hpel;
     if (v->s.pict_type == AV_PICTURE_TYPE_B && !v->second_field && dir == 1) {
         if (dim)
-            n = scaleforopp_y(v, n, dir) << hpel;
+            n = scaleforopp_y(v, n, dir) * (1 << hpel);
         else
-            n = scaleforopp_x(v, n) << hpel;
+            n = scaleforopp_x(v, n)      * (1 << hpel);
         return n;
     }
     if (v->s.pict_type != AV_PICTURE_TYPE_B)



More information about the ffmpeg-cvslog mailing list