summaryrefslogtreecommitdiff
path: root/libswresample/resample2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-27 14:31:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-27 14:31:53 +0200
commita67cb012e6947fb238193afc0f18114f6e20818c (patch)
tree01ecf64a9586a60ae48da3ddfe0a5e0d2507962c /libswresample/resample2.c
parent3e4375833d964ebb5d38816126ff0101ae696cf9 (diff)
resample: Fix overflow
Found-by: Jim Radford Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/resample2.c')
-rw-r--r--libswresample/resample2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libswresample/resample2.c b/libswresample/resample2.c
index 6af2b6c661..5a2082478b 100644
--- a/libswresample/resample2.c
+++ b/libswresample/resample2.c
@@ -224,8 +224,10 @@ AVResampleContext *swr_resample_init(AVResampleContext *c, int out_rate, int in_
}
c->compensation_distance= 0;
- 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);
c->frac= 0;