diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-27 14:31:53 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-27 14:31:53 +0200 |
commit | a67cb012e6947fb238193afc0f18114f6e20818c (patch) | |
tree | 01ecf64a9586a60ae48da3ddfe0a5e0d2507962c /libavcodec/resample2.c | |
parent | 3e4375833d964ebb5d38816126ff0101ae696cf9 (diff) | |
download | ffmpeg-a67cb012e6947fb238193afc0f18114f6e20818c.tar.gz |
resample: Fix overflow
Found-by: Jim Radford
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/resample2.c')
-rw-r--r-- | libavcodec/resample2.c | 6 |
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; |