1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-03 05:10:03 +02:00

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 <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-07-01 13:39:43 +02:00
parent 56fd4705c0
commit 0ea099ad3e

View File

@ -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<<QMAT_SHIFT) - bias - 1;
threshold2= (threshold1<<1);