Fix potential integer overflow.

ioc found a potential integer overflow in the rate control.

This is related to https://code.google.com/p/webm/issues/detail?id=821

Change-Id: Ib6c4acd6e964972f932fce7490592eb134f2b7ea
This commit is contained in:
Frank Galligan 2014-12-04 16:26:47 -08:00
Родитель b43c27ab6e
Коммит 4c4d7261e4
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -426,8 +426,8 @@ void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
}
// Work out a size correction factor.
if (projected_size_based_on_q > FRAME_OVERHEAD_BITS)
correction_factor = (100 * cpi->rc.projected_frame_size) /
projected_size_based_on_q;
correction_factor = (int)((100 * (int64_t)cpi->rc.projected_frame_size) /
projected_size_based_on_q);
// More heavily damped adjustment used if we have been oscillating either side
// of target.