aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-12-22 17:58:24 +0100
committerReinhard Tartler <siretart@tauware.de>2013-01-12 19:34:40 +0100
commit910c1f2352830f1c0e7505cc96c77eac556df083 (patch)
treed29be4654c4423d8ae0b786c42b69f9e92ff0383 /libavformat
parent55065315caf138223b1f2f4e168fc64f601d1352 (diff)
downloadffmpeg-910c1f2352830f1c0e7505cc96c77eac556df083.tar.gz
oggdec: check memory allocation
(cherry picked from commit ba064ebe48376e199f353ef0b335ed8a39c638c5) Conflicts: libavformat/oggdec.c
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/oggdec.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 8c94f4e618..a28232a04e 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -160,8 +160,13 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
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;
@@ -293,6 +298,8 @@ static int 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;