[FFmpeg-cvslog] resample: Fix overflow
Michael Niedermayer
git at videolan.org
Fri Nov 4 13:22:23 CET 2011
ffmpeg | branch: release/0.8 | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 27 14:31:53 2011 +0200| [6ae93d030476ddd7fa2ab4d9d2dd25df85725390] | committer: Michael Niedermayer
resample: Fix overflow
Found-by: Jim Radford
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ae93d030476ddd7fa2ab4d9d2dd25df85725390
---
libavcodec/resample2.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c
index b940059..fc8ffea 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;
More information about the ffmpeg-cvslog
mailing list