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

Michael Niedermayer git at videolan.org
Wed Jul 3 14:56:05 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jul  1 10:01:11 2013 +0200| [78962d3df49afe5011b572656ecfe940bd5fbf2e] | committer: Luca Barbato

jpeg2000: Check that nreslevels2decode has been initialized before use

Avoid buffer overread.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

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

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 705399a..5889f80 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -206,6 +206,11 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
     int reslevelno, bandno, gbandno = 0, ret, i, j;
     uint32_t csize = 1;
 
+    if (!codsty->nreslevels2decode) {
+        av_log(avctx, AV_LOG_ERROR, "nreslevels2decode uninitialized\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (ret = ff_jpeg2000_dwt_init(&comp->dwt, comp->coord,
                                    codsty->nreslevels2decode - 1,
                                    codsty->transform))



More information about the ffmpeg-cvslog mailing list