Browse Source

oggparsedirac: check return value of init_get_bits

If init_get_bits fails the GetBitContext is invalid and must not be
used. Check the return value in dirac_header and propogate the error.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4f5c2e651a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.4.11
Chris Watkins Michael Niedermayer 10 years ago
parent
commit
3fb241210a
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      libavformat/oggparsedirac.c

+ 8
- 3
libavformat/oggparsedirac.c View File

@@ -31,14 +31,19 @@ static int dirac_header(AVFormatContext *s, int idx)
AVStream *st = s->streams[idx]; AVStream *st = s->streams[idx];
dirac_source_params source; dirac_source_params source;
GetBitContext gb; GetBitContext gb;
int ret;


// already parsed the header // already parsed the header
if (st->codec->codec_id == AV_CODEC_ID_DIRAC) if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
return 0; return 0;


init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
return -1;
ret = init_get_bits8(&gb, os->buf + os->pstart + 13, (os->psize - 13));
if (ret < 0)
return ret;

ret = avpriv_dirac_parse_sequence_header(st->codec, &gb, &source);
if (ret < 0)
return ret;


st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = AV_CODEC_ID_DIRAC; st->codec->codec_id = AV_CODEC_ID_DIRAC;


Loading…
Cancel
Save