[FFmpeg-devel] [PATCH 1/2] wavdec: make sample count check more precise

Ganesh Ajjanagadde gajjanagadde at gmail.com
Wed Jul 29 06:28:15 CEST 2015


May be used to fix Ticket4577

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavformat/wavdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 9bc8c4f..db42f59 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -430,7 +430,7 @@ break_loop:
     avio_seek(pb, data_ofs, SEEK_SET);
 
     if (   data_size > 0 && sample_count && st->codec->channels
-        && data_size / sample_count / st->codec->channels > 8) {
+        && (data_size << 3) / sample_count / st->codec->channels > st->codec->bits_per_coded_sample) {
         av_log(s, AV_LOG_WARNING, "ignoring wrong sample_count %"PRId64"\n", sample_count);
         sample_count = 0;
     }
-- 
2.5.0



More information about the ffmpeg-devel mailing list