summaryrefslogtreecommitdiff
path: root/libavcodec/error_resilience.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-23 21:56:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-23 22:03:32 +0100
commit71c2a70cbfbb5fea6dffa5e462b0227565e29bcc (patch)
tree7d9f75183f6e526d3ec0eac74bd88817a23c280b /libavcodec/error_resilience.c
parente2d110d8d21469987b6e5866398ef01654560c3b (diff)
error_concealment: Prevent FPEs in case of corrupted input.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/error_resilience.c')
-rw-r--r--libavcodec/error_resilience.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index cd6aa01803..c93cea58dc 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -248,7 +248,7 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w,
weight_sum = 0;
guess = 0;
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];
weight_sum += weight;
}