diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-09 21:43:06 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-10-24 11:37:29 +0200 |
commit | 5df35d9a21d55e69126757ad32df88764d4f27f0 (patch) | |
tree | 704d88147a494aefde0806c9fc38e48e04287771 | |
parent | a5ef62ede16a3245507f3d596faa45c775603052 (diff) | |
download | ffmpeg-5df35d9a21d55e69126757ad32df88764d4f27f0.tar.gz |
avformat/wavdec: Dont trust the fact chunk for PCM
Fixes Ticket3033
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 83fc6c822b06688e572333299927d93eb3c6c426)
Conflicts:
libavformat/wav.c
(cherry picked from commit 89b5f5f494a2387541de8960839c2539a73a31fa)
-rw-r--r-- | libavformat/wav.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/wav.c b/libavformat/wav.c index 5bd76a95bc..08637f736e 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -532,8 +532,15 @@ break_loop: avio_seek(pb, data_ofs, SEEK_SET); - if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id)) - sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); + if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0) + if ( st->codec->channels + && data_size + && av_get_bits_per_sample(st->codec->codec_id) + && wav->data_end <= avio_size(pb)) + sample_count = (data_size << 3) + / + (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); + if (sample_count) st->duration = sample_count; |