swresample/resample: Fix undefined shifts
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 14 Mar 2015 00:15:37 +0000 (01:15 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 14 Mar 2015 00:15:37 +0000 (01:15 +0100)
Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libswresample/resample.c

index d0f6e20..d4c7d06 100644 (file)
@@ -338,7 +338,7 @@ static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, A
 static int64_t get_delay(struct SwrContext *s, int64_t base){
     ResampleContext *c = s->resample;
     int64_t num = s->in_buffer_count - (c->filter_length-1)/2;
-    num <<= c->phase_shift;
+    num *= 1 << c->phase_shift;
     num -= c->index;
     num *= c->src_incr;
     num -= c->frac;