aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-10-09 06:17:12 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-10-09 22:25:19 +0200
commit1018a92219a38a812cf97761c6b3a5e66a400f4b (patch)
tree6045b9d270bd76e24913811be8fae661f19931fb /libavcodec
parent071e29af4d383bdb44d0c87416dee3e4bb597936 (diff)
downloadffmpeg-1018a92219a38a812cf97761c6b3a5e66a400f4b.tar.gz
jpeg2000: Check block length
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/jpeg2000dec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 18346f9e59..cc154c3522 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -715,6 +715,13 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,
}
cblk->length += cblk->lengthinc;
cblk->lengthinc = 0;
+
+ if (cblk->length > sizeof(cblk->data)) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Block length %d > data size %zd\n",
+ cblk->length, sizeof(cblk->data));
+ return AVERROR_INVALIDDATA;
+ }
}
}
return 0;