avcodec/sonic: Check init_get_bits8() for failure

Fixes: CID1322310

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-09-04 01:18:13 +02:00
parent a51d4246d8
commit 6ae1a32d8a

View File

@ -858,6 +858,7 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
SonicContext *s = avctx->priv_data; SonicContext *s = avctx->priv_data;
GetBitContext gb; GetBitContext gb;
int i; int i;
int ret;
s->channels = avctx->channels; s->channels = avctx->channels;
s->samplerate = avctx->sample_rate; s->samplerate = avctx->sample_rate;
@ -868,7 +869,9 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
init_get_bits8(&gb, avctx->extradata, avctx->extradata_size); ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size);
if (ret < 0)
return ret;
s->version = get_bits(&gb, 2); s->version = get_bits(&gb, 2);
if (s->version >= 2) { if (s->version >= 2) {