summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-29 23:44:40 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-06 02:51:27 +0100
commit8cd3def81d11c20052a0044d59c67da3e1a1a5c8 (patch)
tree519ede6f3511933fdad8da87e4854dc9ce211a39 /libavcodec
parent460710500e172042144784a3152aa8d1c5c29cf6 (diff)
downloadffmpeg-8cd3def81d11c20052a0044d59c67da3e1a1a5c8.tar.gz
avcodec/mpeg4videodec: Check available data before reading custom matrix
Fixes: out of array read Fixes: 76c515fc3779d1b838667c61ea13ce92/asan_heap-oob_1fc0d07_8913_794a4629a264ebdb25b58d3a94ed1785.bit Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 891dc8f87536ac2ec695c70d081345224524ad99) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpeg4videodec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index f15747f6ab..7d664cc844 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1881,6 +1881,10 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
int last = 0;
for (i = 0; i < 64; i++) {
int j;
+ if (get_bits_left(gb) < 8) {
+ av_log(s->avctx, AV_LOG_ERROR, "insufficient data for custom matrix\n");
+ return AVERROR_INVALIDDATA;
+ }
v = get_bits(gb, 8);
if (v == 0)
break;
@@ -1904,6 +1908,10 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
int last = 0;
for (i = 0; i < 64; i++) {
int j;
+ if (get_bits_left(gb) < 8) {
+ av_log(s->avctx, AV_LOG_ERROR, "insufficient data for custom matrix\n");
+ return AVERROR_INVALIDDATA;
+ }
v = get_bits(gb, 8);
if (v == 0)
break;