Commit 10e9d1f7 authored by Thierry Foucu's avatar Thierry Foucu Committed by Michael Niedermayer

Fix a heap-buffer-overflow

In some case, what left to read from ptr is smaller than EXTRABYTES.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 3c5fe5b5
......@@ -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, EXTRABYTES);
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);
#if !UNCHECKED_BITSTREAM_READER
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment