avcodec/gsmdec_template: avoid undefined negative left shifts
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 3 Sep 2015 19:58:59 +0000 (21:58 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 3 Sep 2015 20:17:24 +0000 (22:17 +0200)
Fixes: unknown_unknown_338_824_cov_1045285351_sample-gsm-8000.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/gsmdec_template.c

index 0c60813..4cb777c 100644 (file)
@@ -64,7 +64,7 @@ static inline int decode_log_area(int coded, int factor, int offset)
 {
     coded <<= 10;
     coded -= offset;
-    return gsm_mult(coded, factor) << 1;
+    return gsm_mult(coded, factor) * 2;
 }
 
 static av_noinline int get_rrp(int filtered)
@@ -121,7 +121,7 @@ static int postprocess(int16_t *data, int msr)
     int i;
     for (i = 0; i < 160; i++) {
         msr = av_clip_int16(data[i] + gsm_mult(msr, 28180));
-        data[i] = av_clip_int16(msr << 1) & ~7;
+        data[i] = av_clip_int16(msr * 2) & ~7;
     }
     return msr;
 }