mirror of
https://github.com/librempeg/librempeg
synced 2024-11-23 03:28:27 +00:00
segafilm: Validate the number of audio channels
This avoids divisions by zero later. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
601c2015bc
commit
82e266c6d3
@ -111,6 +111,11 @@ static int film_read_header(AVFormatContext *s)
|
|||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
film->audio_samplerate = AV_RB16(&scratch[24]);
|
film->audio_samplerate = AV_RB16(&scratch[24]);
|
||||||
film->audio_channels = scratch[21];
|
film->audio_channels = scratch[21];
|
||||||
|
if (!film->audio_channels || film->audio_channels > 2) {
|
||||||
|
av_log(s, AV_LOG_ERROR,
|
||||||
|
"Invalid number of channels: %d\n", film->audio_channels);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
film->audio_bits = scratch[22];
|
film->audio_bits = scratch[22];
|
||||||
if (scratch[23] == 2)
|
if (scratch[23] == 2)
|
||||||
film->audio_type = AV_CODEC_ID_ADPCM_ADX;
|
film->audio_type = AV_CODEC_ID_ADPCM_ADX;
|
||||||
|
Loading…
Reference in New Issue
Block a user