aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-14 19:16:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-14 19:34:00 +0200
commit5deb96c5641c58d4c1a820971347c3f76cc945d4 (patch)
tree95220e165f272b4e04ef8cddab4acca068843b97 /libavcodec
parenta75d2a6505bf85c947a2428bd2f18f0bb6d0fcd1 (diff)
downloadffmpeg-5deb96c5641c58d4c1a820971347c3f76cc945d4.tar.gz
avcodec/jpeg2000dec: Check Psot
Fixes out of array read Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/jpeg2000dec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index b856db4b22..11fa7f63ac 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -469,6 +469,10 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
/* Read TNSot but not used */
bytestream2_get_byteu(&s->g); // TNsot
+ if (Psot > bytestream2_get_bytes_left(&s->g) + n + 2) {
+ av_log(s->avctx, AV_LOG_ERROR, "Psot %d too big\n", Psot);
+ return AVERROR_INVALIDDATA;
+ }
if (TPsot >= FF_ARRAY_ELEMS(s->tile[s->curtileno].tile_part)) {
av_log(s->avctx, AV_LOG_ERROR, "TPsot %d too big\n", TPsot);
return AVERROR_PATCHWELCOME;