lavf/wavdec: add sanity check for AVCodecContext.channels
authorJames Almer <jamrial@gmail.com>
Mon, 18 Aug 2014 06:14:01 +0000 (03:14 -0300)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 18 Aug 2014 07:29:25 +0000 (09:29 +0200)
Fixes ticket #3862.
As a side effect, this also fixes aac_latm in wav.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/wavdec.c

index 7e0d5f4..9c4e2df 100644 (file)
@@ -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;
     }