diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-26 03:30:46 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-26 03:30:46 +0100 |
commit | 46095f427ec12ef7a036f1b9e206c9054c217d4f (patch) | |
tree | d8f26a6a7cd5f21745770d7665b86687f0f9f0af | |
parent | 10e9d1f76b4bec7a3c581ab7ac494f55acc6f24d (diff) | |
download | ffmpeg-46095f427ec12ef7a036f1b9e206c9054c217d4f.tar.gz |
mp3dec: Check for memcpy size to be positive.
No, ive no testcase.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/mpegaudiodec.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index f9764335b3..a6a5d8632b 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); |