[FFmpeg-cvslog] mp3dec: Check for memcpy size to be positive.

Michael Niedermayer git at videolan.org
Thu Jan 26 08:48:23 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Jan 26 03:30:46 2012 +0100| [46095f427ec12ef7a036f1b9e206c9054c217d4f] | committer: Michael Niedermayer

mp3dec: Check for memcpy size to be positive.

No, ive no testcase.

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

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

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

diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index f976433..a6a5d86 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1385,7 +1385,8 @@ static int mp_decode_layer3(MPADecodeContext *s)
         av_dlog(s->avctx, "seekback: %d\n", main_data_begin);
     //av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size);
 
-        memcpy(s->last_buf + s->last_buf_size, ptr,
+        if (s->gb.size_in_bits > get_bits_count(&s->gb))
+            memcpy(s->last_buf + s->last_buf_size, ptr,
                FFMIN(EXTRABYTES, (s->gb.size_in_bits - get_bits_count(&s->gb))>>3));
         s->in_gb = s->gb;
         init_get_bits(&s->gb, s->last_buf, s->last_buf_size*8);



More information about the ffmpeg-cvslog mailing list