[FFmpeg-cvslog] oggdec: Check memory allocation
Federico Tomassetti
git at videolan.org
Sun Mar 22 04:12:30 CET 2015
ffmpeg | branch: master | Federico Tomassetti <federico at tomassetti.me> | Sat Mar 21 10:44:59 2015 +0000| [27aa1ff35a13bc471c6e0a9cc496ec3f62f1574f] | committer: Luca Barbato
oggdec: Check memory allocation
Bug-Id: CID 1257798 / CID 1257805
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=27aa1ff35a13bc471c6e0a9cc496ec3f62f1574f
---
libavformat/oggdec.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 760cc25..86ea70f 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);
More information about the ffmpeg-cvslog
mailing list