diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-11-08 10:35:14 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-11-08 10:35:14 +0100 |
commit | 4d7c71c36467331f1e0c0f17af9f371d33308a9c (patch) | |
tree | 9a0abce5245b3ffaef479b88b29b66587e72ee53 /libavformat/audiointerleave.c | |
parent | 8a3f976498cc096644b95ade7240a73e17d3a042 (diff) | |
download | ffmpeg-4d7c71c36467331f1e0c0f17af9f371d33308a9c.tar.gz |
Check for OOM after av_mallocz() in ff_interleave_add_packet().
Fixes a crash with the sample from Ubuntu bug #869125.
Diffstat (limited to 'libavformat/audiointerleave.c')
-rw-r--r-- | libavformat/audiointerleave.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c index 844112fcf5..922f4a5880 100644 --- a/libavformat/audiointerleave.c +++ b/libavformat/audiointerleave.c @@ -113,10 +113,13 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt } av_fifo_generic_write(aic->fifo, pkt->data, pkt->size, NULL); } else { + int ret; // rewrite pts and dts to be decoded time line position pkt->pts = pkt->dts = aic->dts; aic->dts += pkt->duration; - ff_interleave_add_packet(s, pkt, compare_ts); + ret = ff_interleave_add_packet(s, pkt, compare_ts); + if (ret < 0) + return ret; } pkt = NULL; } @@ -125,8 +128,12 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt AVStream *st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { AVPacket new_pkt; - while (ff_interleave_new_audio_packet(s, &new_pkt, i, flush)) - ff_interleave_add_packet(s, &new_pkt, compare_ts); + int ret; + while (ff_interleave_new_audio_packet(s, &new_pkt, i, flush)) { + ret = ff_interleave_add_packet(s, &new_pkt, compare_ts); + if (ret < 0) + return ret; + } } } |