Commit 71c2a70c authored by Michael Niedermayer's avatar Michael Niedermayer

error_concealment: Prevent FPEs in case of corrupted input.

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent e2d110d8
...@@ -248,7 +248,7 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, ...@@ -248,7 +248,7 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w,
weight_sum = 0; weight_sum = 0;
guess = 0; guess = 0;
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
int64_t weight = 256 * 256 * 256 * 16 / dist[b_x + b_y*stride][j]; int64_t weight = 256 * 256 * 256 * 16 / FFMAX(dist[b_x + b_y*stride][j], 1);
guess += weight*(int64_t)col[b_x + b_y*stride][j]; guess += weight*(int64_t)col[b_x + b_y*stride][j];
weight_sum += weight; weight_sum += weight;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment