[FFmpeg-cvslog] avcodec/mpc8: check for overread first

Paul B Mahol git at videolan.org
Fri Mar 30 11:16:47 EEST 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Mar 29 21:36:56 2018 +0200| [91bb871376730a2394ed0ae1a3fd4295977002d3] | committer: Paul B Mahol

avcodec/mpc8: check for overread first

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavcodec/mpc8.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 80e0e9e68d..355a9d2f3f 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -419,11 +419,11 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
     c->last_bits_used = get_bits_count(gb);
     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) {
+    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;
+    } else if (c->cur_frame == 0 && get_bits_left(gb) < 8) {// we have only padding left
+        c->last_bits_used = buf_size << 3;
     }
 
     *got_frame_ptr = 1;



More information about the ffmpeg-cvslog mailing list