avcodec/jpeg2000dec: check transform equality in MCT
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Aug 2013 01:33:40 +0000 (03:33 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 13 Oct 2013 17:23:24 +0000 (19:23 +0200)
Fixes null pointer dereference
Fixes Ticket2843

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeg2000dec.c

index aae3697..cbba2d0 100644 (file)
@@ -1140,6 +1140,12 @@ static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
     int32_t *src[3],  i0,  i1,  i2;
     float   *srcf[3], i0f, i1f, i2f;
 
+    for (i = 1; i < 3; i++)
+        if (tile->codsty[0].transform != tile->codsty[i].transform) {
+            av_log(s->avctx, AV_LOG_ERROR, "Transforms mismatch, MCT not supported\n");
+            return;
+        }
+
     for (i = 0; i < 3; i++)
         if (tile->codsty[0].transform == FF_DWT97)
             srcf[i] = tile->comp[i].f_data;