summaryrefslogtreecommitdiff
path: root/libavcodec/mpc8.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-03-30 12:32:00 +0200
committerPaul B Mahol <onemda@gmail.com>2018-03-30 12:52:54 +0200
commitcc402282551d493829455fd097890cc6e2bc556a (patch)
tree1ec4b46399d35da41af26de49d52b68d4254e007 /libavcodec/mpc8.c
parent11f8f9547dbfdd181fed6ffa8270d8c80ae69ef5 (diff)
downloadffmpeg-cc402282551d493829455fd097890cc6e2bc556a.tar.gz
avcodec/mpc8: check for overread earlier and abort decoding frame
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/mpc8.c')
-rw-r--r--libavcodec/mpc8.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 355a9d2f3f..6347e1f691 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -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;