diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-06-11 14:28:24 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-23 13:15:16 +0200 |
commit | a21a9f9d0bed21d3c812a98e08c22537920583bc (patch) | |
tree | 73474221f637b71adc7b1210d14eab8b0337d6fb | |
parent | ec704dc779be65d73c36e17c7984f807b80c8599 (diff) | |
download | ffmpeg-a21a9f9d0bed21d3c812a98e08c22537920583bc.tar.gz |
avcodec/mpc8: Correct end truncation
Fixes Ticket5478
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b21f674876badefc68e4deecdb4a1d46de10b67c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mpc8.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 29c65f9ef5..af15f66952 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -415,10 +415,14 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, c->cur_frame++; c->last_bits_used = get_bits_count(gb); - if(get_bits_left(gb) < 8) // we have only padding left - c->last_bits_used = buf_size << 3; if(c->cur_frame >= c->frames) c->cur_frame = 0; + if(c->cur_frame == 0 && get_bits_left(gb) < 8) {// we have only padding left + c->last_bits_used = buf_size << 3; + } else if (get_bits_left(gb) < 0) { + av_log(avctx, AV_LOG_ERROR, "Overread %d\n", -get_bits_left(gb)); + c->last_bits_used = buf_size << 3; + } *got_frame_ptr = 1; |