[FFmpeg-cvslog] avcodec/mpegvideo: Fix undefined left shift of negative numbers

Andreas Rheinhardt git at videolan.org
Fri Sep 30 05:49:59 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Sep 28 20:00:41 2022 +0200| [e5f6918cbd5d7b6024f83ff86075d5e762c38034] | committer: Andreas Rheinhardt

avcodec/mpegvideo: Fix undefined left shift of negative numbers

Fixes the rv20-1239 FATE-test.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

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

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index d8c7bc687d..5095149eaa 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -843,7 +843,7 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
         s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, src,
                                  s->linesize, s->linesize,
                                  w + 1, (h + 1) << field_based,
-                                 src_x, src_y   << field_based,
+                                 src_x, src_y * (1 << field_based),
                                  h_edge_pos, v_edge_pos);
         src = s->sc.edge_emu_buffer;
         emu = 1;
@@ -945,7 +945,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
         s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr_y,
                                  linesize >> field_based, linesize >> field_based,
                                  17, 17 + field_based,
-                                src_x, src_y << field_based, h_edge_pos,
+                                src_x, src_y * (1 << field_based), h_edge_pos,
                                 v_edge_pos);
         ptr_y = s->sc.edge_emu_buffer;
         if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
@@ -956,12 +956,12 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
             s->vdsp.emulated_edge_mc(ubuf,  ptr_cb,
                                      uvlinesize >> field_based, uvlinesize >> field_based,
                                      9, 9 + field_based,
-                                    uvsrc_x, uvsrc_y << field_based,
+                                    uvsrc_x, uvsrc_y * (1 << field_based),
                                     h_edge_pos >> 1, v_edge_pos >> 1);
             s->vdsp.emulated_edge_mc(vbuf,  ptr_cr,
                                      uvlinesize >> field_based,uvlinesize >> field_based,
                                      9, 9 + field_based,
-                                    uvsrc_x, uvsrc_y << field_based,
+                                    uvsrc_x, uvsrc_y * (1 << field_based),
                                     h_edge_pos >> 1, v_edge_pos >> 1);
             ptr_cb = ubuf;
             ptr_cr = vbuf;



More information about the ffmpeg-cvslog mailing list