[FFmpeg-devel,13/15] avcodec/vc1_pred: Fix undefined left shifts of negative numbers

Submitted by Andreas Rheinhardt on Sept. 24, 2019, 10:03 p.m.

Details

Message ID 20190924220310.31157-14-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt Sept. 24, 2019, 10:03 p.m.
Affects the FATE-tests vc1_sa10143, vc1_ilaced_twomv.

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

Patch hide | download patch | download mbox

diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
index e1ad0e1d7d..f714d7ce22 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 = FFLSHIFT(scaleforopp_y(v, n, dir), hpel);
         else
-            n = scaleforopp_x(v, n) << hpel;
+            n = FFLSHIFT(scaleforopp_x(v, n), hpel);
         return n;
     }
     if (v->s.pict_type != AV_PICTURE_TYPE_B)