diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-03 16:04:13 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-01-09 04:06:32 +0100 |
commit | 10663312de979404d2417a120a3c85a68cf70dd5 (patch) | |
tree | 90ca8dfb6a37c7c47baa4cdd1950b2c2e3b8a5ec /libavcodec/ac3dec.c | |
parent | 277281ac8eb7337a8d6dbddc9ffcfffabe44b40c (diff) | |
download | ffmpeg-10663312de979404d2417a120a3c85a68cf70dd5.tar.gz |
avcodec/ac3dec: Check operations that can fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r-- | libavcodec/ac3dec.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index eaa327a3ee..3e4bec56b1 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -184,22 +184,25 @@ static av_cold void ac3_tables_init(void) static av_cold int ac3_decode_init(AVCodecContext *avctx) { AC3DecodeContext *s = avctx->priv_data; - int i; + int i, ret; s->avctx = avctx; ac3_tables_init(); - ff_mdct_init(&s->imdct_256, 8, 1, 1.0); - ff_mdct_init(&s->imdct_512, 9, 1, 1.0); + if ((ret = ff_mdct_init(&s->imdct_256, 8, 1, 1.0)) < 0 || + (ret = ff_mdct_init(&s->imdct_512, 9, 1, 1.0)) < 0) + return ret; AC3_RENAME(ff_kbd_window_init)(s->window, 5.0, 256); ff_bswapdsp_init(&s->bdsp); #if (USE_FIXED) s->fdsp = avpriv_alloc_fixed_dsp(avctx->flags & AV_CODEC_FLAG_BITEXACT); #else - s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); ff_fmt_convert_init(&s->fmt_conv, avctx); + s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); #endif + if (!s->fdsp) + return AVERROR(ENOMEM); ff_ac3dsp_init(&s->ac3dsp, avctx->flags & AV_CODEC_FLAG_BITEXACT); av_lfg_init(&s->dith_state, 0); |