summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-13 19:36:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-13 19:36:50 +0200
commit97064019279d227669ea3db583a8a8aa47e970ba (patch)
treeee727ca00b1d84329ec70b4bf64af12c1cfa2af2 /libavcodec/mpeg12dec.c
parent6a64b23d93d05b765fbeff51b75d0c75e940bf9a (diff)
avcodec/mpeg12dec: check slice size before trying to decode it
Fixes assertion failure Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg12dec.c')
-rw-r--r--libavcodec/mpeg12dec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 9b17941b94..262a5a3ac7 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2299,6 +2299,11 @@ static int decode_chunks(AVCodecContext *avctx,
if (s2->picture_structure == PICT_BOTTOM_FIELD)
mb_y++;
+ if (buf_end - buf_ptr < 2) {
+ av_log(s2->avctx, AV_LOG_ERROR, "slice too small\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (mb_y >= s2->mb_height) {
av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height);
return -1;