]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mpc8: check for overread earlier and abort decoding frame
authorPaul B Mahol <onemda@gmail.com>
Fri, 30 Mar 2018 10:32:00 +0000 (12:32 +0200)
committerPaul B Mahol <onemda@gmail.com>
Fri, 30 Mar 2018 10:52:54 +0000 (12:52 +0200)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/mpc8.c

index 355a9d2f3fb5420319ed0ec819b9d5428f1f0e02..6347e1f691dabf950c01b92c0040872fc2301950 100644 (file)
@@ -273,6 +273,11 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
         if(maxband > 32) maxband -= 33;
     }
 
+    if (get_bits_left(gb) < 0) {
+        *got_frame_ptr = 0;
+        return buf_size;
+    }
+
     if(maxband > c->maxbands + 1) {
         av_log(avctx, AV_LOG_ERROR, "maxband %d too large\n",maxband);
         return AVERROR_INVALIDDATA;