summaryrefslogtreecommitdiff
path: root/libavformat/oggdec.c
diff options
context:
space:
mode:
authorFederico Tomassetti <federico@tomassetti.me>2015-03-21 10:44:59 +0000
committerLuca Barbato <lu_zero@gentoo.org>2015-03-21 23:18:15 +0100
commit27aa1ff35a13bc471c6e0a9cc496ec3f62f1574f (patch)
treeda8f3966a164e0d2eba115dc562075d0fa25e0bd /libavformat/oggdec.c
parent93c1b04abfc0dd31211a18bf2c0041d69cd16919 (diff)
oggdec: Check memory allocation
Bug-Id: CID 1257798 / CID 1257805 Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r--libavformat/oggdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 760cc25b8c..86ea70f777 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -64,6 +64,8 @@ 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;
@@ -192,6 +194,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);