summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12dec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/mpeg12dec.c')
-rw-r--r--libavcodec/mpeg12dec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index ed1d09fc62..0e8627c4a4 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2978,6 +2978,10 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
GetBitContext *gb = &m->gb;
int ret;
+ // Check for minimal intra MB size (considering mb header, luma & chroma dc VLC, ac EOB VLC)
+ if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 + 3*4 + 2*2 + 2*6))
+ return AVERROR_INVALIDDATA;
+
ret = ff_get_buffer(avctx, frame, 0);
if (ret < 0)
return ret;