aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-11-26 16:50:51 +0000
committerMans Rullgard <mans@mansr.com>2011-11-26 18:50:27 +0000
commitf7f892e4d5bded48b08e7b776a5fb7c350496f2b (patch)
tree218c98b5a39d1cf4acdb239ef62a73a06776d5e2
parente4faa31a0a68dbff320b419a3a73d6b028d770d5 (diff)
downloadffmpeg-f7f892e4d5bded48b08e7b776a5fb7c350496f2b.tar.gz
svq1enc: fix signed multiplication overflow
This multiplication can overflow the signed range but not the unsigned. After right-shifting it will thus fit in the signed range again. Signed-off-by: Mans Rullgard <mans@mansr.com>
-rw-r--r--libavcodec/svq1enc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 79aaa6cb26..01d8b315b8 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -160,7 +160,7 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *dec
}
best_count=0;
- best_score -= ((block_sum[0]*block_sum[0])>>(level+3));
+ best_score -= (int)(((unsigned)block_sum[0]*block_sum[0])>>(level+3));
best_mean= (block_sum[0] + (size>>1)) >> (level+3);
if(level<4){