Commit 2ccc08c5 authored by bcoudurier's avatar bcoudurier

avoid integer overflow in dnxhd encoder, fixes #1557

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20557 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 20d7f45b
...@@ -574,9 +574,11 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx) ...@@ -574,9 +574,11 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)
last_higher = FFMAX(lambda, last_higher); last_higher = FFMAX(lambda, last_higher);
if (last_lower != INT_MAX) if (last_lower != INT_MAX)
lambda = (lambda+last_lower)>>1; lambda = (lambda+last_lower)>>1;
else if ((int64_t)lambda + up_step > INT_MAX)
return -1;
else else
lambda += up_step; lambda += up_step;
up_step *= 5; up_step = FFMIN((int64_t)up_step*5, INT_MAX);
down_step = 1<<LAMBDA_FRAC_BITS; down_step = 1<<LAMBDA_FRAC_BITS;
} }
} }
......
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