aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mvi.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-10 18:15:33 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-10 18:15:33 +0100
commitea1d8465e6eca582c09e2526f677033b62576fda (patch)
tree7223f6ae16a228db3cd8251068170f9b607fb0b7 /libavformat/mvi.c
parentcb85779d459c6486acbbf060b3f169779424583e (diff)
downloadffmpeg-ea1d8465e6eca582c09e2526f677033b62576fda.tar.gz
Fix division by 0 due to audio frame size
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mvi.c')
-rw-r--r--libavformat/mvi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index 6b74597f07..953c1824fa 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -96,6 +96,10 @@ static int read_header(AVFormatContext *s)
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;
+ if (!mvi->audio_frame_size) {
+ av_log(s, AV_LOG_ERROR, "audio_frame_size is 0\n");
+ return AVERROR_INVALIDDATA;
+ }
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;