diff mbox series

[FFmpeg-devel,1/5] avformat/wav: prevent muxing adpcm_swf with a variable block size

Message ID 20201016062049.2746-2-zane@zanevaniperen.com
State Superseded
Headers show
Series Fix adpcm_swf support in WAV.
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Zane van Iperen Oct. 16, 2020, 6:22 a.m. UTC
Prefer to error than to create a broken file. Closes ticket #5829.

Effectively disables remuxing adpcm_swf from flv -> wav.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
 libavformat/wavenc.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c
index 1027f107ee..fe7afa03a0 100644
--- a/libavformat/wavenc.c
+++ b/libavformat/wavenc.c
@@ -303,6 +303,13 @@  static int wav_write_header(AVFormatContext *s)
         return AVERROR(EINVAL);
     }
 
+    if (s->streams[0]->codecpar->codec_id == AV_CODEC_ID_ADPCM_SWF &&
+        s->streams[0]->codecpar->block_align == 0) {
+        av_log(s, AV_LOG_ERROR, "%s can only be written to WAVE with a constant frame size\n",
+               avcodec_get_name(s->streams[0]->codecpar->codec_id));
+        return AVERROR(EINVAL);
+    }
+
     if (wav->rf64 == RF64_ALWAYS) {
         ffio_wfourcc(pb, "RF64");
         avio_wl32(pb, -1); /* RF64 chunk size: use size in ds64 */