[FFmpeg-cvslog] resample: Fix array size

Michael Niedermayer git at videolan.org
Fri Nov 4 13:22:24 CET 2011


ffmpeg | branch: release/0.8 | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 27 15:26:45 2011 +0200| [edf3c5a3ebeee8df55c6a05f88a682091f10a364] | committer: Michael Niedermayer

resample: Fix array size

Found-by: Jim Radford
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 3e7db0a9ee758bf0570a141be1fea64f8d9c03db)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=edf3c5a3ebeee8df55c6a05f88a682091f10a364
---

 libavcodec/resample.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/resample.c b/libavcodec/resample.c
index 33413db..68e604e 100644
--- a/libavcodec/resample.c
+++ b/libavcodec/resample.c
@@ -326,9 +326,9 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
     if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) {
         output_bak = output;
 
-        if (!s->buffer_size[1] || s->buffer_size[1] < lenout) {
+        if (!s->buffer_size[1] || s->buffer_size[1] < 2*lenout) {
             av_free(s->buffer[1]);
-            s->buffer_size[1] = lenout;
+            s->buffer_size[1] = 2*lenout;
             s->buffer[1] = av_malloc(s->buffer_size[1]);
             if (!s->buffer[1]) {
                 av_log(s->resample_context, AV_LOG_ERROR, "Could not allocate buffer\n");



More information about the ffmpeg-cvslog mailing list