aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZane van Iperen <zane@zanevaniperen.com>2020-10-16 00:02:18 +1000
committerZane van Iperen <zane@zanevaniperen.com>2020-10-21 11:23:23 +1000
commit53ac499f0132b924315ce26c2683d6eb1717ce29 (patch)
treec50661c73559ad74139b5286992553d9d889360e
parent637c154a5048f60d0b59d35941d4d528edf56370 (diff)
downloadffmpeg-53ac499f0132b924315ce26c2683d6eb1717ce29.tar.gz
avformat/riff: prevent muxing adpcm_swf with a variable block size
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>
-rw-r--r--libavformat/riffenc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 04a21fcffa..df04b31893 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -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. */