ffmdec: check av_new_packet() return value

Fixes CID733711
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-10-17 20:45:59 +02:00
parent a0e0e1e192
commit f03c0f6afc

View File

@ -386,7 +386,9 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
duration = AV_RB24(ffm->header + 5); duration = AV_RB24(ffm->header + 5);
av_new_packet(pkt, size); if (av_new_packet(pkt, size) < 0) {
return AVERROR(ENOMEM);
}
pkt->stream_index = ffm->header[0]; pkt->stream_index = ffm->header[0];
if ((unsigned)pkt->stream_index >= s->nb_streams) { if ((unsigned)pkt->stream_index >= s->nb_streams) {
av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index); av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index);