aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-27 14:34:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-11-06 19:49:12 +0100
commitd39cc3c092936896d787c29d7e215a273e22a57e (patch)
treefccba119e3c6c048f6df51dc5d7429efd09cad32
parente124c3c298a7abe2ded2b90817915c5baf8ea1be (diff)
downloadffmpeg-d39cc3c092936896d787c29d7e215a273e22a57e.tar.gz
resample2: fix potential overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit a39b5e8b323785695fb0e3c0f30bd9e24287db87) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/resample2.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c
index 01478190a3..19fed30a38 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);