mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-08 23:58:51 +00:00
segafilm: Fix potential division by 0 on corrupted segafilm streams in the demuxer.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
7cbe025758
commit
c58d45e004
@ -113,11 +113,14 @@ static int film_read_header(AVFormatContext *s,
|
|||||||
film->audio_bits = scratch[22];
|
film->audio_bits = scratch[22];
|
||||||
if (scratch[23] == 2)
|
if (scratch[23] == 2)
|
||||||
film->audio_type = CODEC_ID_ADPCM_ADX;
|
film->audio_type = CODEC_ID_ADPCM_ADX;
|
||||||
else if (film->audio_bits == 8)
|
else if (film->audio_channels > 0) {
|
||||||
film->audio_type = CODEC_ID_PCM_S8;
|
if (film->audio_bits == 8)
|
||||||
else if (film->audio_bits == 16)
|
film->audio_type = CODEC_ID_PCM_S8;
|
||||||
film->audio_type = CODEC_ID_PCM_S16BE;
|
else if (film->audio_bits == 16)
|
||||||
else
|
film->audio_type = CODEC_ID_PCM_S16BE;
|
||||||
|
else
|
||||||
|
film->audio_type = CODEC_ID_NONE;
|
||||||
|
} else
|
||||||
film->audio_type = CODEC_ID_NONE;
|
film->audio_type = CODEC_ID_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +204,7 @@ static int film_read_header(AVFormatContext *s,
|
|||||||
if (film->audio_type == CODEC_ID_ADPCM_ADX)
|
if (film->audio_type == CODEC_ID_ADPCM_ADX)
|
||||||
audio_frame_counter += (film->sample_table[i].sample_size * 32 /
|
audio_frame_counter += (film->sample_table[i].sample_size * 32 /
|
||||||
(18 * film->audio_channels));
|
(18 * film->audio_channels));
|
||||||
else
|
else if (film->audio_type != CODEC_ID_NONE)
|
||||||
audio_frame_counter += (film->sample_table[i].sample_size /
|
audio_frame_counter += (film->sample_table[i].sample_size /
|
||||||
(film->audio_channels * film->audio_bits / 8));
|
(film->audio_channels * film->audio_bits / 8));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user