avcodec/vp9: Fix undefined shifts in decode_frame_header()
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Mar 2015 01:01:33 +0000 (02:01 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Mar 2015 14:31:41 +0000 (15:31 +0100)
Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu@google.com>
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/vp9.c

index 265dc7e..0405c05 100644 (file)
@@ -689,10 +689,10 @@ static int decode_frame_header(AVCodecContext *ctx,
         for (j = 1; j < 4; j++) {
             s->segmentation.feat[i].lflvl[j][0] =
                 av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
-                                         s->lf_delta.mode[0]) << sh), 6);
+                                         s->lf_delta.mode[0]) * (1 << sh)), 6);
             s->segmentation.feat[i].lflvl[j][1] =
                 av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
-                                         s->lf_delta.mode[1]) << sh), 6);
+                                         s->lf_delta.mode[1]) * (1 << sh)), 6);
         }
     }