You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
avcodec/liblc3dec: sanitize channel count in avctx
Should prevent out of array accesses. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@ -46,6 +46,12 @@ static av_cold int liblc3_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
if (avctx->extradata_size < 10)
|
if (avctx->extradata_size < 10)
|
||||||
return AVERROR_INVALIDDATA;
|
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->frame_us = AV_RL16(avctx->extradata + 0) * 10;
|
||||||
liblc3->srate_hz = avctx->sample_rate;
|
liblc3->srate_hz = avctx->sample_rate;
|
||||||
|
Reference in New Issue
Block a user