mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
libopusdec: fix out-of-bounds read
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
parent
dc2ad09493
commit
fc85646ad4
@ -48,6 +48,13 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
|
||||
avc->channels = 2;
|
||||
}
|
||||
|
||||
avc->channels = avc->extradata_size >= 10 ? avc->extradata[9] : (avc->channels == 1) ? 1 : 2;
|
||||
if (avc->channels <= 0) {
|
||||
av_log(avc, AV_LOG_WARNING,
|
||||
"Invalid number of channels %d, defaulting to stereo\n", avc->channels);
|
||||
avc->channels = 2;
|
||||
}
|
||||
|
||||
avc->sample_rate = 48000;
|
||||
avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
|
||||
AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
|
||||
|
Loading…
x
Reference in New Issue
Block a user