smacker: Don't return packets in unallocated streams

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2013-09-11 15:20:01 +03:00
parent 48d6556dd4
commit 8d928023f9

View File

@ -344,6 +344,8 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
smk->cur_frame++; smk->cur_frame++;
smk->nextpos = avio_tell(s->pb); smk->nextpos = avio_tell(s->pb);
} else { } else {
if (smk->stream_id[smk->curstream] < 0)
return AVERROR_INVALIDDATA;
if (av_new_packet(pkt, smk->buf_sizes[smk->curstream])) if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
memcpy(pkt->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]); memcpy(pkt->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]);