[FFmpeg-devel] [PATCH] wav: Add check for 'fmt' tag

Derek Buitenhuis derek.buitenhuis at gmail.com
Wed Jul 18 18:15:21 CEST 2012


If there is a 'data' tag, but no 'fmt' tag, it is possible that
'st' got used as NULL.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
---
 libavformat/wav.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/wav.c b/libavformat/wav.c
index c408623..a6b58cb 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -531,6 +531,11 @@ break_loop:
         return AVERROR_INVALIDDATA;
     }
 
+    if (!st) {
+        av_log(s, AV_LOG_ERROR, "no 'fmt' tag found\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     avio_seek(pb, data_ofs, SEEK_SET);
 
     if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list