avcodec/wmaenc: Check ff_wma_init() for failure

Fixes null pointer dereference
Fixes: c4faf8280ba366bf00a79d425f2910a8/signal_sigsegv_1f96477_5177_1448ba7e4125faceb966f44ceb69abfa.qcp
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 19e456d48c)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2016-01-21 02:38:05 +01:00
parent 0732e7b0ea
commit 9e44ea7c0f
1 changed files with 3 additions and 1 deletions

View File

@ -32,6 +32,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
WMACodecContext *s = avctx->priv_data; WMACodecContext *s = avctx->priv_data;
int i, flags1, flags2, block_align; int i, flags1, flags2, block_align;
uint8_t *extradata; uint8_t *extradata;
int ret;
s->avctx = avctx; s->avctx = avctx;
@ -78,7 +79,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
if (avctx->channels == 2) if (avctx->channels == 2)
s->ms_stereo = 1; s->ms_stereo = 1;
ff_wma_init(avctx, flags2); if ((ret = ff_wma_init(avctx, flags2)) < 0)
return ret;
/* init MDCT */ /* init MDCT */
for (i = 0; i < s->nb_block_sizes; i++) for (i = 0; i < s->nb_block_sizes; i++)