Browse Source

oggdec: Check memory allocation

Bug-Id: CID 1257798 / CID 1257805

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
tags/n2.7
Federico Tomassetti Luca Barbato 10 years ago
parent
commit
27aa1ff35a
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavformat/oggdec.c

+ 5
- 0
libavformat/oggdec.c View File

@@ -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);


Loading…
Cancel
Save