[FFmpeg-cvslog] avcodec/diracdec: fix undefined behavior with shifts

Michael Niedermayer git at videolan.org
Tue Apr 22 00:59:48 CEST 2014


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Wed Apr 16 02:06:37 2014 +0200| [d51e0dd9b4d4169722092462feeb8e7c4b6bcf81] | committer: Michael Niedermayer

avcodec/diracdec: fix undefined behavior with shifts

Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit b8598f6ce61ccda3f2ff0c730b009fb650e42986)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index c431b97..2f1a4a5 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1342,8 +1342,8 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5],
         motion_y >>= s->chroma_y_shift;
     }
 
-    mx         = motion_x & ~(-1 << s->mv_precision);
-    my         = motion_y & ~(-1 << s->mv_precision);
+    mx         = motion_x & ~(-1U << s->mv_precision);
+    my         = motion_y & ~(-1U << s->mv_precision);
     motion_x >>= s->mv_precision;
     motion_y >>= s->mv_precision;
     /* normalize subpel coordinates to epel */



More information about the ffmpeg-cvslog mailing list