[FFmpeg-devel] [PATCH] lavf/wavdec: add sanity check for AVCodecContext.channels

James Almer jamrial at gmail.com
Mon Aug 18 08:14:01 CEST 2014


Fixes ticket #3862.
As a side effect, this also fixes aac_latm in wav.

Signed-off-by: James Almer <jamrial at gmail.com>
---
Maybe a check for channels <= 0 should be also added to ff_get_wav_header()
right after the sample_rate one?

 libavformat/wavdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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



More information about the ffmpeg-devel mailing list