]> git.sesse.net Git - ffmpeg/commitdiff
avformat/riff: prevent muxing adpcm_swf with a variable block size
authorZane van Iperen <zane@zanevaniperen.com>
Thu, 15 Oct 2020 14:02:18 +0000 (00:02 +1000)
committerZane van Iperen <zane@zanevaniperen.com>
Wed, 21 Oct 2020 01:23:23 +0000 (11:23 +1000)
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/riffenc.c

index 04a21fcffaabc8c4c680d5caa7840b7858072d81..df04b318932a6ce8236c0ee4aa08945f5625c86b 100644 (file)
@@ -65,6 +65,12 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb,
     if (!par->codec_tag || par->codec_tag > 0xffff)
         return -1;
 
+    if (par->codec_id == AV_CODEC_ID_ADPCM_SWF && par->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(par->codec_id));
+        return AVERROR(EINVAL);
+    }
+
     /* We use the known constant frame size for the codec if known, otherwise
      * fall back on using AVCodecContext.frame_size, which is not as reliable
      * for indicating packet duration. */