[FFmpeg-devel] [PATCH v2 09/15] avcodec/vc1_pred: Fix undefined left shifts of negative numbers

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sat Sep 28 05:26:04 EEST 2019


Affects the FATE-tests vc1_sa10143, vc1_ilaced_twomv.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/vc1_pred.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
index e1ad0e1d7d..08412b3435 100644
--- a/libavcodec/vc1_pred.c
+++ b/libavcodec/vc1_pred.c
@@ -191,10 +191,10 @@ 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);
         else
-            n = scaleforopp_x(v, n) << hpel;
-        return n;
+            n = scaleforopp_x(v, n);
+        return n * (1 << hpel);
     }
     if (v->s.pict_type != AV_PICTURE_TYPE_B)
         refdist = v->refdist;
-- 
2.20.1



More information about the ffmpeg-devel mailing list