[FFmpeg-cvslog] jpeg2000dec: check TPsot

Michael Niedermayer git at videolan.org
Wed May 22 02:58:23 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed May 22 02:31:03 2013 +0200| [73ffab41959a17650d552dceefbb11e524a430d4] | committer: Michael Niedermayer

jpeg2000dec: check TPsot

Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73ffab41959a17650d552dceefbb11e524a430d4
---

 libavcodec/jpeg2000dec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 4e03e0e..125aacd 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;



More information about the ffmpeg-cvslog mailing list