[FFmpeg-cvslog] Do not allow writing invalid wav channel layouts by default.

Carl Eugen Hoyos git at videolan.org
Thu Apr 10 01:34:16 CEST 2014


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Wed Apr  9 22:31:40 2014 +0200| [bf87d582b1cbbb5604d4e1521c4b674206e605a0] | committer: Carl Eugen Hoyos

Do not allow writing invalid wav channel layouts by default.

Neither WMP nor QT play wav files with too large channel layouts.
Fixes ticket #3543.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf87d582b1cbbb5604d4e1521c4b674206e605a0
---

 libavformat/riffenc.c |    4 +++-
 libavformat/version.h |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index c3e3e66..6c91cb6 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -172,12 +172,14 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
     }
     /* write WAVEFORMATEXTENSIBLE extensions */
     if (waveformatextensible) {
+        int write_channel_mask = enc->strict_std_compliance < FF_COMPLIANCE_NORMAL ||
+                                 enc->channel_layout < 0x40000;
         /* 22 is WAVEFORMATEXTENSIBLE size */
         avio_wl16(pb, riff_extradata - riff_extradata_start + 22);
         /* ValidBitsPerSample || SamplesPerBlock || Reserved */
         avio_wl16(pb, bps);
         /* dwChannelMask */
-        avio_wl32(pb, enc->channel_layout);
+        avio_wl32(pb, write_channel_mask ? enc->channel_layout : 0);
         /* GUID + next 3 */
         if (enc->codec_id == AV_CODEC_ID_EAC3) {
             ff_put_guid(pb, get_codec_guid(enc->codec_id, ff_codec_wav_guids));
diff --git a/libavformat/version.h b/libavformat/version.h
index fe54380..3d2bb6d 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR 55
 #define LIBAVFORMAT_VERSION_MINOR 36
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MICRO 103
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list