From 0ea099ad3e6d82a09538ad2c93e193187d70345d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 1 Jul 2015 13:39:43 +0200 Subject: [PATCH] avcodec/mpegvideo_enc: fix undefined shifts in ff_dct_quantize_c() Fixes: signal_sigsegv_35eac16_2762_cov_2704249783_missing_frames.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo_enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index e729d36aa2..7f84bccf2c 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -4559,12 +4559,12 @@ int ff_dct_quantize_c(MpegEncContext *s, start_i = 1; last_non_zero = 0; qmat = n < 4 ? s->q_intra_matrix[qscale] : s->q_chroma_intra_matrix[qscale]; - bias= s->intra_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT); + bias= s->intra_quant_bias*(1<<(QMAT_SHIFT - QUANT_BIAS_SHIFT)); } else { start_i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; - bias= s->inter_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT); + bias= s->inter_quant_bias*(1<<(QMAT_SHIFT - QUANT_BIAS_SHIFT)); } threshold1= (1<