aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/jpeg2000.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-05 18:04:20 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-05 18:34:07 +0200
commit6e9bfc19bd7be2b28258ca93d706cb67ed482c65 (patch)
treeaa4f8e06b973e0f1ce4d0eb5f3c7f19da288c2cd /libavcodec/jpeg2000.c
parent16f3102f41031f70a24cf25836b1b7ab972c1265 (diff)
downloadffmpeg-6e9bfc19bd7be2b28258ca93d706cb67ed482c65.tar.gz
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@gmx.at>
Diffstat (limited to 'libavcodec/jpeg2000.c')
-rw-r--r--libavcodec/jpeg2000.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 14f36c4eaf..a2c3e47bad 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))