diff options
author | Stéphane Cerveau <scerveau@collabora.com> | 2021-08-24 09:43:43 -0400 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2021-08-26 09:20:56 +0200 |
commit | f9fbe2f9a9c7d2db98a6e49504a7154f743cd804 (patch) | |
tree | efdf5faab7bd50845c891a4a9b08cdc1bd227db2 /libavcodec/wmadec.c | |
parent | 521388edb7d3c176b444bbc3a42723cbafab2d55 (diff) | |
download | ffmpeg-f9fbe2f9a9c7d2db98a6e49504a7154f743cd804.tar.gz |
avcodec/wmadec: handle run_level_decode error
Consider data as invalid if ff_wma_run_level_decode
gets out with an error.
It avoids an unpleasant sound distorsion.
See http://trac.ffmpeg.org/ticket/9358
Diffstat (limited to 'libavcodec/wmadec.c')
-rw-r--r-- | libavcodec/wmadec.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index d627bbe50e..cc67244344 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -601,15 +601,18 @@ static int wma_decode_block(WMACodecContext *s) if (s->channel_coded[ch]) { int tindex; WMACoef *ptr = &s->coefs1[ch][0]; + int ret; /* special VLC tables are used for ms stereo because * there is potentially less energy there */ tindex = (ch == 1 && s->ms_stereo); memset(ptr, 0, s->block_len * sizeof(WMACoef)); - ff_wma_run_level_decode(s->avctx, &s->gb, &s->coef_vlc[tindex], - s->level_table[tindex], s->run_table[tindex], - 0, ptr, 0, nb_coefs[ch], - s->block_len, s->frame_len_bits, coef_nb_bits); + ret = ff_wma_run_level_decode(s->avctx, &s->gb, &s->coef_vlc[tindex], + s->level_table[tindex], s->run_table[tindex], + 0, ptr, 0, nb_coefs[ch], + s->block_len, s->frame_len_bits, coef_nb_bits); + if (ret < 0) + return ret; } if (s->version == 1 && s->avctx->channels >= 2) align_get_bits(&s->gb); |