summaryrefslogtreecommitdiff
path: root/libswresample
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-27 14:34:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-27 14:34:45 +0200
commit1b9ca38d9d06d319fffd61d27e4eb385d6572ba8 (patch)
tree71ba3021437ecd7c7affd2f5d658c7cb452f715f /libswresample
parenta67cb012e6947fb238193afc0f18114f6e20818c (diff)
resample2: fix potential overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/resample2.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libswresample/resample2.c b/libswresample/resample2.c
index 5a2082478b..02f29bacf1 100644
--- a/libswresample/resample2.c
+++ b/libswresample/resample2.c
@@ -269,10 +269,9 @@ int swr_resample(AVResampleContext *c, short *dst, const short *src, int *consum
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);