Skip to content
Snippets Groups Projects
Commit 27aa1ff3 authored by Federico Tomassetti's avatar Federico Tomassetti Committed by Luca Barbato
Browse files

oggdec: Check memory allocation


Bug-Id: CID 1257798 / CID 1257805

Signed-off-by: default avatarLuca Barbato <lu_zero@gentoo.org>
parent 93c1b04a
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,8 @@ static int ogg_save(AVFormatContext *s) ...@@ -64,6 +64,8 @@ static int ogg_save(AVFormatContext *s)
struct ogg_state *ost = struct ogg_state *ost =
av_malloc(sizeof(*ost) + (ogg->nstreams - 1) * sizeof(*ogg->streams)); av_malloc(sizeof(*ost) + (ogg->nstreams - 1) * sizeof(*ogg->streams));
int i; int i;
if (!ost)
return AVERROR(ENOMEM);
ost->pos = avio_tell(s->pb); ost->pos = avio_tell(s->pb);
ost->curidx = ogg->curidx; ost->curidx = ogg->curidx;
ost->next = ogg->state; ost->next = ogg->state;
...@@ -192,6 +194,9 @@ static int ogg_new_buf(struct ogg *ogg, int idx) ...@@ -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); uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
int size = os->bufpos - os->pstart; int size = os->bufpos - os->pstart;
if (!nb)
return AVERROR(ENOMEM);
if (os->buf) { if (os->buf) {
memcpy(nb, os->buf + os->pstart, size); memcpy(nb, os->buf + os->pstart, size);
av_free(os->buf); av_free(os->buf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment