jpeg2000dec: assert that curtileno is valid when used
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 3 Jun 2013 12:37:16 +0000 (14:37 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 3 Jun 2013 12:59:52 +0000 (14:59 +0200)
Fixes CID1026755
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeg2000dec.c

index 5c8db96..c7519c1 100644 (file)
@@ -25,6 +25,7 @@
  * JPEG 2000 image decoder
  */
 
+#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
@@ -1230,6 +1231,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
             break;
         case JPEG2000_SOT:
             if (!(ret = get_sot(s, len))) {
+                av_assert1(s->curtileno >= 0);
                 codsty = s->tile[s->curtileno].codsty;
                 qntsty = s->tile[s->curtileno].qntsty;
                 properties = s->tile[s->curtileno].properties;