avcodec/wmalosslessdec: check block_align
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 1 Oct 2013 23:16:11 +0000 (01:16 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 1 Oct 2013 23:24:19 +0000 (01:24 +0200)
Code copied from wmaprodec

Fixes null pointer dereference
Fixes Ticket3002

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

index df44855..ab764ed 100644 (file)
@@ -178,6 +178,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
     unsigned int channel_mask;
     int i, log2_max_num_subframes;
 
+    if (!avctx->block_align) {
+        av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
+        return AVERROR(EINVAL);
+    }
+
     s->avctx = avctx;
     init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);