aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-27 20:52:39 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-14 16:51:00 +0100
commit8ef86669ca25b71a61e4b69d428b69b5d71ec7b7 (patch)
treee7d863f928d5002a67b37683eecee35bd2f45c13
parent0cd23e0d1e89c0f7faecea997ade67b56abbc83d (diff)
downloadffmpeg-8ef86669ca25b71a61e4b69d428b69b5d71ec7b7.tar.gz
avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_decode*()
Fixes out of array access Fixes: 01859c9a9ac6cd60a008274123275574/asan_heap-oob_1dff571_8250_50d3d1611e294c3519fd1fa82198b69b.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 75422280fbcdfbe9dc56bde5525b4d8b280f1bc5) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jpeg2000dwt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dwt.c b/libavcodec/jpeg2000dwt.c
index ceceda36dc..015a4fec27 100644
--- a/libavcodec/jpeg2000dwt.c
+++ b/libavcodec/jpeg2000dwt.c
@@ -555,6 +555,9 @@ int ff_dwt_encode(DWTContext *s, void *t)
int ff_dwt_decode(DWTContext *s, void *t)
{
+ if (s->ndeclevels == 0)
+ return 0;
+
switch (s->type) {
case FF_DWT97:
dwt_decode97_float(s, t);