summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-12-22 17:58:24 +0100
committerReinhard Tartler <siretart@tauware.de>2013-02-10 18:01:15 +0100
commitfe4409a396d7f577fbcac6c2ff0df3c6eabc3727 (patch)
treeaebe80b9d4ddb648b8efdca4691807b164b8140d
parentc3761b661874174a63aded4933a62aa1246f9339 (diff)
downloadffmpeg-fe4409a396d7f577fbcac6c2ff0df3c6eabc3727.tar.gz
oggdec: check memory allocation
(cherry picked from commit ba064ebe48376e199f353ef0b335ed8a39c638c5) Conflicts: libavformat/oggdec.c
-rw-r--r--libavformat/oggdec.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index cf1df8425a..0bf7db0e52 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -159,8 +159,13 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial)
AVStream *st;
struct ogg_stream *os;
- ogg->streams = av_realloc (ogg->streams,
- ogg->nstreams * sizeof (*ogg->streams));
+ os = av_realloc (ogg->streams, ogg->nstreams * sizeof (*ogg->streams));
+
+ if (!os)
+ return AVERROR(ENOMEM);
+
+ ogg->streams = os;
+
memset (ogg->streams + idx, 0, sizeof (*ogg->streams));
os = ogg->streams + idx;
os->serial = serial;
@@ -279,6 +284,8 @@ ogg_read_page (AVFormatContext * s, int *str)
if (os->bufsize - os->bufpos < size){
uint8_t *nb = av_malloc ((os->bufsize *= 2) + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!nb)
+ return AVERROR(ENOMEM);
memcpy (nb, os->buf, os->bufpos);
av_free (os->buf);
os->buf = nb;