mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
smacker: validate number of channels
This commit is contained in:
parent
a7984a6a6d
commit
e190e453bd
@ -559,6 +559,10 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
|||||||
|
|
||||||
static av_cold int smka_decode_init(AVCodecContext *avctx)
|
static av_cold int smka_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
|
if (avctx->channels < 1 || avctx->channels > 2) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
|
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
|
||||||
avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? AV_SAMPLE_FMT_U8 : AV_SAMPLE_FMT_S16;
|
avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? AV_SAMPLE_FMT_U8 : AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user