diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-20 16:35:39 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-20 17:10:34 +0400 |
commit | 241eccd62898207906df6998807551a565a71138 (patch) | |
tree | d2fccfdf5beb6e77c90386767b874195424f5d65 /libavcodec/mpegvideo_enc.c | |
parent | 3f307d79d383e0ac505c9f8393d94fb36a092c05 (diff) |
avcodec/mpegvideo_enc: fix integer overflow with -skip_exp >= 2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index fb9f4519d6..2153fdac8f 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1148,9 +1148,9 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref) switch (s->avctx->frame_skip_exp) { case 0: score = FFMAX(score, v); break; case 1: score += FFABS(v); break; - case 2: score += v * v; break; - case 3: score64 += FFABS(v * v * (int64_t)v); break; - case 4: score64 += v * v * (int64_t)(v * v); break; + case 2: score64 += v * (int64_t)v; break; + case 3: score64 += FFABS(v * (int64_t)v * v); break; + case 4: score64 += (v * (int64_t)v) * (v * (int64_t)v); break; } } } |