diff options
author | James Almer <jamrial@gmail.com> | 2024-04-04 13:25:55 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2024-04-04 13:55:16 -0300 |
commit | 45d2110fc72638c47a60b35511b4367fa65583cc (patch) | |
tree | 014873fb7f43c7b90a0df1eb286d1a9745f80e81 /libavcodec/liblc3dec.c | |
parent | 240fd04db231efa4abad3abbd808140b4112324a (diff) | |
download | ffmpeg-45d2110fc72638c47a60b35511b4367fa65583cc.tar.gz |
avcodec/liblc3dec: sanitize channel count in avctx
Should prevent out of array accesses.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/liblc3dec.c')
-rw-r--r-- | libavcodec/liblc3dec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c index c0a31bc91f..90da28679b 100644 --- a/libavcodec/liblc3dec.c +++ b/libavcodec/liblc3dec.c @@ -46,6 +46,12 @@ static av_cold int liblc3_decode_init(AVCodecContext *avctx) if (avctx->extradata_size < 10) return AVERROR_INVALIDDATA; + if (channels < 0 || channels > DECODER_MAX_CHANNELS) { + av_log(avctx, AV_LOG_ERROR, + "Invalid number of channels %d. Max %d channels are accepted\n", + channels, DECODER_MAX_CHANNES); + return AVERROR(EINVAL); + } liblc3->frame_us = AV_RL16(avctx->extradata + 0) * 10; liblc3->srate_hz = avctx->sample_rate; |