Prevent heap corruption when resampling 8-bit audio.
authorPeter Ross <pross@xvid.org>
Sun, 15 Feb 2009 06:29:43 +0000 (06:29 +0000)
committerPeter Ross <pross@xvid.org>
Sun, 15 Feb 2009 06:29:43 +0000 (06:29 +0000)
Originally committed as revision 17311 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/resample.c

index 98ceac7..829db76 100644 (file)
@@ -251,7 +251,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
         int ostride[1] = { 2 };
         const void *ibuf[1] = { input };
         void       *obuf[1];
-        unsigned input_size = nb_samples*s->input_channels*s->sample_size[0];
+        unsigned input_size = nb_samples*s->input_channels*2;
 
         if (!s->buffer_size[0] || s->buffer_size[0] < input_size) {
             av_free(s->buffer[0]);