1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-10-01 00:54:33 +02:00

avfilter/vf_psnr: Prevent integer overflow.

The 32-bit integer accumulator in MSE computation can overflow for 8-bit frame data.
(e.g., for 1080p white frame compared to a black frame can give sum of 255*255*1080*1920 > 2^32).

Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Neil Birkbeck 2013-09-20 17:25:40 -07:00 committed by Michael Niedermayer
parent 15672e832f
commit a11c16a0b0

View File

@ -91,7 +91,7 @@ void compute_images_mse(PSNRContext *s,
const uint8_t *ref_line = ref_data[c];
const int ref_linesize = ref_linesizes[c];
const int main_linesize = main_linesizes[c];
int m = 0;
uint64_t m = 0;
for (i = 0; i < outh; i++) {
for (j = 0; j < outw; j++)