mvi: Add sanity checking for the audio frame size
This avoids a division by zero. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit28ff439efd
) Signed-off-by: Luca Barbato <lu_zero@gentoo.org> (cherry picked from commit04d2f9ace3
)
This commit is contained in:

committed by
Luca Barbato

parent
ea1c9424d1
commit
35c39d2ee2
@@ -91,6 +91,12 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24;
|
mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24;
|
||||||
|
|
||||||
mvi->audio_frame_size = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count;
|
mvi->audio_frame_size = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count;
|
||||||
|
if (mvi->audio_frame_size <= 1 << MVI_FRAC_BITS - 1) {
|
||||||
|
av_log(s, AV_LOG_ERROR, "Invalid audio_data_size (%d) or frames_count (%d)\n",
|
||||||
|
mvi->audio_data_size, frames_count);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size;
|
mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size;
|
||||||
mvi->audio_size_left = mvi->audio_data_size;
|
mvi->audio_size_left = mvi->audio_data_size;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user