diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-12 00:11:15 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-12 01:22:09 +0100 |
commit | a202541f9b4da3e489716198dd3547ec7f73ef1d (patch) | |
tree | 3c8841114476a20176e8978fae86e3dc6169d6fa | |
parent | 99a8552dae54fd464f19a00d9e5b92596c5c058a (diff) | |
download | ffmpeg-a202541f9b4da3e489716198dd3547ec7f73ef1d.tar.gz |
cafdec: Check duration before use.
Fix division by 0
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/cafdec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 718942bd8a..f12226a8f5 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -312,7 +312,7 @@ static int read_header(AVFormatContext *s) if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) { if (caf->data_size > 0) st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet; - } else if (st->nb_index_entries) { + } else if (st->nb_index_entries && st->duration > 0) { st->codec->bit_rate = st->codec->sample_rate * caf->data_size * 8 / st->duration; } else { |