diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 18:54:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 19:21:53 +0100 |
commit | 40adcf576f7d93cc46269ce73f64a1d4638ad786 (patch) | |
tree | b70a2fb350df677703978c3d6f0fc722280b83d9 /libavformat | |
parent | 586ba24ff29468d2a4ee843a9650feea5b2be6f6 (diff) | |
download | ffmpeg-40adcf576f7d93cc46269ce73f64a1d4638ad786.tar.gz |
avformat/oggdec: Check for ost allocation failure
Fixes CID1257798
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/oggdec.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index f19c5b1cd3..28057ad2cc 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -68,6 +68,10 @@ static int ogg_save(AVFormatContext *s) struct ogg_state *ost = av_malloc(sizeof(*ost) + (ogg->nstreams - 1) * sizeof(*ogg->streams)); int i; + + if (!ost) + return AVERROR(ENOMEM); + ost->pos = avio_tell(s->pb); ost->curidx = ogg->curidx; ost->next = ogg->state; @@ -583,6 +587,7 @@ static int ogg_get_length(AVFormatContext *s) int i; int64_t size, end; int streams_left=0; + int ret; if (!s->pb->seekable) return 0; @@ -596,7 +601,9 @@ static int ogg_get_length(AVFormatContext *s) return 0; end = size > MAX_PAGE_SIZE ? size - MAX_PAGE_SIZE : 0; - ogg_save(s); + ret = ogg_save(s); + if (ret < 0) + return ret; avio_seek(s->pb, end, SEEK_SET); ogg->page_pos = -1; @@ -618,7 +625,10 @@ static int ogg_get_length(AVFormatContext *s) ogg_restore(s, 0); - ogg_save (s); + ret = ogg_save(s); + if (ret < 0) + return ret; + avio_seek (s->pb, s->internal->data_offset, SEEK_SET); ogg_reset(s); while (streams_left > 0 && !ogg_packet(s, &i, NULL, NULL, NULL)) { |