avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_encode*()
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 27 Nov 2015 20:02:13 +0000 (21:02 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 20 Dec 2015 09:59:27 +0000 (10:59 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit feb3f39614b88c113211a98dda1bc2fe5c3c6957)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/jpeg2000dwt.c

index 015a4fe..925adea 100644 (file)
@@ -540,6 +540,9 @@ int ff_jpeg2000_dwt_init(DWTContext *s, uint16_t border[2][2],
 
 int ff_dwt_encode(DWTContext *s, void *t)
 {
+    if (s->ndeclevels == 0)
+        return 0;
+
     switch(s->type){
         case FF_DWT97:
             dwt_encode97_float(s, t); break;