[FFmpeg-cvslog] avformat/wavdec: Dont trust the fact chunk for PCM

Michael Niedermayer git at videolan.org
Thu Oct 24 11:59:15 CEST 2013


ffmpeg | branch: release/1.2 | Michael Niedermayer <michaelni at gmx.at> | Wed Oct  9 21:43:06 2013 +0200| [970109deaf470dae691a90c7e0d65a652a1a2da4] | committer: Carl Eugen Hoyos

avformat/wavdec: Dont trust the fact chunk for PCM

Fixes Ticket3033

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 83fc6c822b06688e572333299927d93eb3c6c426)

Conflicts:
	libavformat/wavdec.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=970109deaf470dae691a90c7e0d65a652a1a2da4
---

 libavformat/wavdec.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 87d3699..2c6b15e 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -368,8 +368,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) && 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 || 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;
 



More information about the ffmpeg-cvslog mailing list