[FFmpeg-devel] [PATCH] avformat/wavdec: add extra sample count check for G.729 files

Ganesh Ajjanagadde gajjanagadde at gmail.com
Fri Jul 31 02:33:28 CEST 2015


Can be used to fix Ticket4577

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

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 1803b5c..8b48fc8 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -440,6 +440,13 @@ break_loop:
         sample_count = 0;
     }
 
+    /* G.729 hack (for Ticket4577)
+     * FIXME: Come up with cleaner, more general solution */
+    if (st->codec->codec_id == AV_CODEC_ID_G729 && sample_count && (data_size << 3) > sample_count) {
+        av_log(s, AV_LOG_WARNING, "ignoring wrong sample_count %"PRId64"\n", sample_count);
+        sample_count = 0;
+    }
+
     if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0)
         if (   st->codec->channels
             && data_size
-- 
2.5.0



More information about the ffmpeg-devel mailing list