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-04 03:18:52 +0100
commit6ae93d030476ddd7fa2ab4d9d2dd25df85725390 (patch)
treefe520251e880726422069a05b882b2b02ac90123
parent241f15f1c93f5bd661a187e42644220fd89ea7de (diff)
downloadffmpeg-6ae93d030476ddd7fa2ab4d9d2dd25df85725390.tar.gz
resample: Fix overflow
Found-by: Jim Radford 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 b940059d84..fc8ffea466 100644
--- a/libavcodec/resample2.c
+++ b/libavcodec/resample2.c
@@ -207,8 +207,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))
+ goto error;
+ c->ideal_dst_incr= c->dst_incr;
+
c->index= -phase_count*((c->filter_length-1)/2);
return c;