[FFmpeg-cvslog] avcodec/vc1: Fix undefined shifts

Michael Niedermayer git at videolan.org
Sun Mar 15 03:07:55 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Mar 15 02:57:24 2015 +0100| [3b63819dfbeefe8656c816e2dcdba548ff6dfb35] | committer: Michael Niedermayer

avcodec/vc1: Fix undefined shifts

Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu at google.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 22eb358..a84522c 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -572,13 +572,13 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContex
         int scale, shift, i;                                                  \
         if (!lumscale) {                                                      \
             scale = -64;                                                      \
-            shift = (255 - lumshift * 2) << 6;                                \
+            shift = (255 - lumshift * 2) * 64;                                \
             if (lumshift > 31)                                                \
                 shift += 128 << 6;                                            \
         } else {                                                              \
             scale = lumscale + 32;                                            \
             if (lumshift > 31)                                                \
-                shift = (lumshift - 64) << 6;                                 \
+                shift = (lumshift - 64) * 64;                                 \
             else                                                              \
                 shift = lumshift << 6;                                        \
         }                                                                     \



More information about the ffmpeg-cvslog mailing list