diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 17:52:59 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 17:53:35 +0100 |
commit | 9b8152bf047bbebe4495b993258591687bcdd36d (patch) | |
tree | 6393a75001fa0e0b700b8ba6428bc37f09746d41 /libavformat/oggdec.c | |
parent | 56838103020385020469d1da076f0e4a6cbe15e5 (diff) | |
download | ffmpeg-9b8152bf047bbebe4495b993258591687bcdd36d.tar.gz |
avformat/oggdec: Check for av_malloc() failure and forward the error code
Fixes CID1257805
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r-- | libavformat/oggdec.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 3f152a4434..f19c5b1cd3 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -276,6 +276,9 @@ static int ogg_new_buf(struct ogg *ogg, int idx) uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); int size = os->bufpos - os->pstart; + if (!nb) + return AVERROR(ENOMEM); + if (os->buf) { memcpy(nb, os->buf + os->pstart, size); av_free(os->buf); @@ -370,8 +373,11 @@ static int ogg_read_page(AVFormatContext *s, int *sid) ogg->page_pos = os->page_pos = avio_tell(bc) - 27; - if (os->psize > 0) - ogg_new_buf(ogg, idx); + if (os->psize > 0) { + ret = ogg_new_buf(ogg, idx); + if (ret < 0) + return ret; + } ret = avio_read(bc, os->segments, nsegs); if (ret < nsegs) |