diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2014-11-03 00:28:06 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2014-11-03 09:31:48 +0100 |
commit | f0158e6f0cc1bd6bf5d0485a325bdc654fcd3328 (patch) | |
tree | e1800b4206c9e82bc0f9d7d78b2bcb837d814fa5 /libavformat/flvenc.c | |
parent | 4f4de7f49e0d0c37df8fd2f59f59819cdc935da7 (diff) | |
download | ffmpeg-f0158e6f0cc1bd6bf5d0485a325bdc654fcd3328.tar.gz |
lavf/flvenc: fail in case the muxed packet is too big
Avoid the creation of files which cannot be successfully decoded by
ffmpeg, for example generated with:
ffmpeg -f lavfi -i sine -af "aselect='not(between(t,100,500))',aresample=min_comp=0.001:min_hard_comp=0.100000" -acodec pcm_s16le -t 1000 -y out_audio.flv
Diffstat (limited to 'libavformat/flvenc.c')
-rw-r--r-- | libavformat/flvenc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 31a5c9ea11..939e663258 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -548,6 +548,12 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) if (sc->last_ts < ts) sc->last_ts = ts; + if (size + flags_size >= 1<<24) { + av_log(s, AV_LOG_ERROR, "Too large packet with size %u >= %u\n", + size + flags_size, 1<<24); + return AVERROR(EINVAL); + } + avio_wb24(pb, size + flags_size); avio_wb24(pb, ts & 0xFFFFFF); avio_w8(pb, (ts >> 24) & 0x7F); // timestamps are 32 bits _signed_ |