avformat/smacker: Check if bufs has been allocated before use
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 19 Sep 2013 12:20:21 +0000 (14:20 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 19 Sep 2013 12:20:21 +0000 (14:20 +0200)
Fixes null pointer dereference

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

index b9bb07e..0f52dc1 100644 (file)
@@ -351,7 +351,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
         smk->cur_frame++;
         smk->nextpos = avio_tell(s->pb);
     } else {
-        if (smk->stream_id[smk->curstream] < 0)
+        if (smk->stream_id[smk->curstream] < 0 || !smk->bufs[smk->curstream])
             return AVERROR_INVALIDDATA;
         if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
             return AVERROR(ENOMEM);