diff options
author | James Almer <jamrial@gmail.com> | 2022-03-17 22:04:35 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-21 16:12:04 -0300 |
commit | 6bab6afecc513bfd242b5992547e8050cac8f95c (patch) | |
tree | 5d936905c21971b0b8d92b5faa91f0cf0c1421dc /libavcodec/wmaprodec.c | |
parent | 37f44406829d477e27aa9440327b86b4355cf6c9 (diff) | |
download | ffmpeg-6bab6afecc513bfd242b5992547e8050cac8f95c.tar.gz |
avcodec/wmaprodec: ensure channel count in the private context and decoder context are consistent
avctx->ch_layout will be reinitialized using channel_mask later in the
function.
Fixes: 45736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5769886813519872
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/wmaprodec.c')
-rw-r--r-- | libavcodec/wmaprodec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index a2ee9b0440..8e1675dc78 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -403,7 +403,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu s->decode_flags = AV_RL16(edata_ptr+14); channel_mask = AV_RL32(edata_ptr+2); s->bits_per_sample = AV_RL16(edata_ptr); - s->nb_channels = avctx->ch_layout.nb_channels; + s->nb_channels = channel_mask ? av_popcount(channel_mask) : avctx->ch_layout.nb_channels; if (s->bits_per_sample > 32 || s->bits_per_sample < 1) { avpriv_request_sample(avctx, "bits per sample is %d", s->bits_per_sample); |