[FFmpeg-cvslog] jpeg2000dec: Check compno in get_coc()

Michael Niedermayer git at videolan.org
Fri Jun 14 02:16:23 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jun 14 01:54:30 2013 +0200| [e850a064cee3c291d8e122a6284bb0ea1a59787f] | committer: Michael Niedermayer

jpeg2000dec: Check compno in get_coc()

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=e850a064cee3c291d8e122a6284bb0ea1a59787f
---

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

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 87a1d58..b856db4 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -354,6 +354,11 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
 
     compno = bytestream2_get_byteu(&s->g);
 
+    if (compno >= s->ncomponents) {
+        av_log(s->avctx, AV_LOG_ERROR, "Invalid compno %d\n", compno);
+        return AVERROR_INVALIDDATA;
+    }
+
     c      += compno;
     c->csty = bytestream2_get_byteu(&s->g);
 



More information about the ffmpeg-cvslog mailing list