avcodec/gsmdec_template: avoid undefined negative left shifts

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>
This commit is contained in:
Michael Niedermayer 2015-09-03 21:58:59 +02:00
parent 9ed53d5a8a
commit e5aa6f7021

View 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;
}