[FFmpeg-cvslog] resample2: fix potential overflow
Michael Niedermayer
git at videolan.org
Sun Nov 6 20:18:57 CET 2011
ffmpeg | branch: release/0.5 | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 27 14:34:45 2011 +0200| [d39cc3c092936896d787c29d7e215a273e22a57e] | committer: Michael Niedermayer
resample2: fix potential overflow
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit a39b5e8b323785695fb0e3c0f30bd9e24287db87)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d39cc3c092936896d787c29d7e215a273e22a57e
---
libavcodec/resample2.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c
index 0147819..19fed30 100644
--- a/libavcodec/resample2.c
+++ b/libavcodec/resample2.c
@@ -227,10 +227,9 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
dst[dst_index] = src[index2>>32];
index2 += incr;
}
- frac += dst_index * dst_incr_frac;
index += dst_index * dst_incr;
- index += frac / c->src_incr;
- frac %= c->src_incr;
+ index += (frac + dst_index * (int64_t)dst_incr_frac) / c->src_incr;
+ frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->src_incr;
}else{
for(dst_index=0; dst_index < dst_size; dst_index++){
FELEM *filter= c->filter_bank + c->filter_length*(index & c->phase_mask);
More information about the ffmpeg-cvslog
mailing list