[FFmpeg-cvslog] jpeg2000: check that nreslevels2decode has been initialized before use

Michael Niedermayer git at videolan.org
Wed Jun 5 18:39:56 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Jun  5 18:04:20 2013 +0200| [6e9bfc19bd7be2b28258ca93d706cb67ed482c65] | committer: Michael Niedermayer

jpeg2000: check that nreslevels2decode has been initialized before use

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=6e9bfc19bd7be2b28258ca93d706cb67ed482c65
---

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

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 14f36c4..a2c3e47 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -200,6 +200,11 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
     int reslevelno, bandno, gbandno = 0, ret, i, j;
     uint32_t csize;
 
+    if (codsty->nreslevels2decode <= 0) {
+        av_log(avctx, AV_LOG_ERROR, "nreslevels2decode %d invalid or uninitialized\n", codsty->nreslevels2decode);
+        return AVERROR(EINVAL);
+    }
+
     if (ret = ff_jpeg2000_dwt_init(&comp->dwt, comp->coord,
                                    codsty->nreslevels2decode - 1,
                                    codsty->transform))



More information about the ffmpeg-cvslog mailing list