summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-22 02:31:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-22 02:53:21 +0200
commit73ffab41959a17650d552dceefbb11e524a430d4 (patch)
treeebe369176c03d03448995f6ff3c1101a4812ee21 /libavcodec/jpeg2000dec.c
parentfec8783883f789802ba6596ce4c324aa5c040754 (diff)
jpeg2000dec: check TPsot
Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r--libavcodec/jpeg2000dec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 4e03e0ebe2..125aacded6 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -432,6 +432,11 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
/* Read TNSot but not used */
bytestream2_get_byteu(&s->g); // TNsot
+ 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;
+ }
+
tp = s->tile[s->curtileno].tile_part + TPsot;
tp->tile_index = Isot;
tp->tp_len = Psot;