mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-24 02:09:03 +03:00
avcodec: nellymoser: reject invalid sample rate
Nellymoser expects the caller to set the samplerate, as it
doesn't read it from the bitstream. However the generic check
for this is bypassed as it has the AV_CODEC_CAP_CHANNEL_CONF
capability because it does set the channel configuration,
however that cap also bypasses the generic samplerate check.
This is mostly harmless as nellymoser doesn't care about the
samplerate, but since f566032bfd it would cause an AVERROR_BUG
to be returned to the caller, so better reject it outright in
the decoder.
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
This commit is contained in:
@@ -121,6 +121,11 @@ static av_cold int decode_init(AVCodecContext * avctx)
|
||||
float scale = 1.0f;
|
||||
NellyMoserDecodeContext *s = avctx->priv_data;
|
||||
|
||||
if (avctx->sample_rate <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Sample rate %d is invalid\n", avctx->sample_rate);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->avctx = avctx;
|
||||
s->imdct_out = s->imdct_buf[0];
|
||||
s->imdct_prev = s->imdct_buf[1];
|
||||
|
||||
Reference in New Issue
Block a user