aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-27 14:31:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-11-06 19:49:12 +0100
commite124c3c298a7abe2ded2b90817915c5baf8ea1be (patch)
tree90ced923865dc9f68f16df1c6469a65a0efddd57
parent8acc0546bbb0deacdf1e79f5486a0811840246fc (diff)
downloadffmpeg-e124c3c298a7abe2ded2b90817915c5baf8ea1be.tar.gz
resample: Fix overflow
Found-by: Jim Radford Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 6ae93d030476ddd7fa2ab4d9d2dd25df85725390) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/resample2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c
index ac9db73c8c..01478190a3 100644
--- a/libavcodec/resample2.c
+++ b/libavcodec/resample2.c
@@ -190,8 +190,10 @@ AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size,
memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM));
c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_length - 1];
- c->src_incr= out_rate;
- c->ideal_dst_incr= c->dst_incr= in_rate * phase_count;
+ if(!av_reduce(&c->src_incr, &c->dst_incr, out_rate, in_rate * (int64_t)phase_count, INT32_MAX/2))
+ return NULL;
+ c->ideal_dst_incr= c->dst_incr;
+
c->index= -phase_count*((c->filter_length-1)/2);
return c;