summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* libavformat/flacenc: reject too big picture blocksMattias Wadman2019-11-01
| | | | | | | | | | | | | | | | A too big picture will case the muxer to write a truncated block size (uint24) causing the output file to be corrupt. How to reproduce: Write a file with truncated block size: ffmpeg -y -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:a:0 -map 1:v:0 -c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac Try to decode: ffmpeg -i test.flac test.wav Signed-off-by: Mattias Wadman <mattias.wadman@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hlsenc: fix the av_dirname path isn't include separator in the end ↵Limin Wang2019-10-31
| | | | | | | of string Reviewed-by: Liu Steven <lq@chinaffmpeg.org> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/apngenc: Add deinit functionAndreas Rheinhardt2019-10-30
| | | | | | | | | | Prevents memleaks when the trailer is never written (e.g. when there was a write error when writing the header). Fixes ticket #8347. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/hls: Set AVFMT_TS_DISCONT flag on HLS input formatPhilip Langdale2019-10-30
| | | | | | | | | | | | | | | | | | | | | | | | | | There have been many reports over the years about problems when taking an HLS stream as input to `ffmpeg` where there are timestamp discontinuities present. This is explicitly supported in the HLS spec (EXT-X-DISCONTINUITY) and often used for ad injection. Various fixes and work-arounds have been proposed over the years, but one step that seems obvious, even if it's not a complete fix, is to mark the HLS input format as supporting discontinuities. This will prevent timestamp fixup logic in ffmpeg.c kicking in that ends up mangling the timestamps unnecessarily. I've tested this out with an example provided by Joe Koberg early last year, and it is sufficient to allow `ffmpeg` to download and mux the stream correctly. Joe had briefly suggested that other situations can still be handled incorrectly, but this seems like a strict improvement. Joe's example: https://s3.amazonaws.com/playon-test-videos/discont_test_new/discont_test.m3u8 Reviewed-by: Steven Liu <lq@onvideo.cn> Reviewed-by: Dennis Mungai <dmngaie@gmail.com>
* avformat/dss: Remove superfluous headersAndreas Rheinhardt2019-10-29
| | | | | | | | Both attributes.h and bswap.h have been included from the very beginning of this muxer without there being any reason to do so. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wc3movie: fix memleak when read content size not equvipe input sizeSteven Liu2019-10-28
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/swfdec: fix memleak when inflateInit failedSteven Liu2019-10-28
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/smacker: fix memleak when avformat_new_stream failedSteven Liu2019-10-28
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/rtmpproto: fix memleak when open rtmp failedSteven Liu2019-10-28
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/rl2: fix memleak when read end of fileSteven Liu2019-10-28
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/mpc8: fix memleak when seek table too bigSteven Liu2019-10-28
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/libmodplug: fix memleak when load modplug failedSteven Liu2019-10-28
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: move freep segment from sls_flags_filename_process after ↵Steven Liu2019-10-28
| | | | | | caller failed Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/avienc: Remove superfluous headerAndreas Rheinhardt2019-10-25
| | | | | | | | | 04d2540c added intreadwrite.h to avienc.c, although there was (and is) no need to do so. The inclusion seems to be a mistake as this commit added a AV_WL32 to avidec.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/avidec: Remove superfluous headerAndreas Rheinhardt2019-10-25
| | | | | | | | | | | bswap.h was included since 7b114c09, yet since 3788a3c0 no explicit use of anything from bswap.h has been made, so remove this header. (Only AV_RL32 is used and while this might imply swapping on big-endian systems, it is contained in libavutil/intreadwrite.h.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/asfenc: Remove unnecessary headerAndreas Rheinhardt2019-10-25
| | | | | | | | | libavutil/parseutils.h has been included in 22bbd6e8 for av_parse_time() and the header has not been removed when said function was replaced by ff_parse_creation_time_metadata() in ea1bf08a. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aiffenc: Add deinit functionAndreas Rheinhardt2019-10-25
| | | | | | | Prevents memleaks if the trailer is never written. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/bintext: avoid division by zeroPaul B Mahol2019-10-25
| | | | Fixes #8335
* avformat/tee.c: steal bsf option before passing to fifo muxerJun Li2019-10-25
| | | | | | | | | Fix #7620 In the case tee muxer with both "bsf" and "use_fifo" parameters will trigger this bug. Tee muxer will first steal parameters (like "f", "select"...) and then "use_fifo" will try reading out remaining options and pass them to fifo as option "format_options". Current code miss the part of stealing "bsf" options.
* avformat/mpeg: Don't free unintialized pointerAndreas Rheinhardt2019-10-24
| | | | | | | | | | | | In order to fix a potential memleak upon failure, 0b8956b2 made sure that a buffer given by a pointer was freed upon error. But this pointer was only initialized upon use and in several cases (Clang gives no fewer than 13 -Wsometimes-uninitialized warnings) this meant that an uninitialized pointer was used to free a buffer. So initialize the pointer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/icoenc: Add deinit functionAndreas Rheinhardt2019-10-24
| | | | | | | | Prevents memleaks in situations where the trailer isn't written, e.g. because of errors during writing the header. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aiffenc: Use better error codesAndreas Rheinhardt2019-10-24
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: Add padding to extradataAndreas Rheinhardt2019-10-24
| | | | | | | | | Extradata is supposed to be padded with AV_INPUT_BUFFER_PADDING_SIZE bytes, yet the VobSub demuxer used av_strdup for the allocation of extradata. This has been changed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: move the header_str free into end labelSteven Liu2019-10-22
| | | | | | fix CID: 1454875 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/segafilmenc: remove unneeded codeSteven Liu2019-10-22
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/matroskaenc: CosmeticsAndreas Rheinhardt2019-10-21
| | | | | | | | | | Contains renaming of variables (e.g. mkv_write_cues() contained variables called tracknum that actually contain the index of a track in s->streams and not the track number (which can differ in case an explicit dash track number is set)). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskaenc: Use more appropriate function nameAndreas Rheinhardt2019-10-21
| | | | | | | | | | | | | | mkv_start_new_cluster() actually didn't start a new cluster, but ended the old one instead and emitted a debug message that it had started a new cluster. This has been changed: The debug message has been moved to the place that really starts a new cluster and the function has been renamed to mkv_end_cluster(). Furthermore, without this debug message the function can be used for flushing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskaenc: Remove redundant assertAndreas Rheinhardt2019-10-21
| | | | | | | | | | | | | | The Matroska muxer groups index entries with the same pts together in order to save a few bytes. Because of Matroska's variable-length length fields, mkv_write_cues() does this by first finding out how many index entries will be grouped together before actually writing them. Currently, it is asserted at both of these stages that the stream index of the list of designated index entries is valid. But the second assert is redundant, because the very same index entries have already been checked. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskaenc: Move track-related fields to mkv_trackAndreas Rheinhardt2019-10-21
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskaenc: Use ffio_free_dyn_bufAndreas Rheinhardt2019-10-21
| | | | | | | instead of replicating its behaviour. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskaenc: Fix memleak upon failureAndreas Rheinhardt2019-10-21
| | | | | | | | | | | | | | | | | The Matroska muxer up until now leaked memory in two scenarios: 1. If an error happened during writing the trailer, as mkv_write_trailer() returned early without cleaning up. 2. If mkv_write_header() indicated success despite an error in the underlying AVIOContext. In this case avformat_write_header() returned the IO error and according to the API the caller is not allowed to call av_write_trailer(), so that no cleanup happened for the allocations made in mkv_write_header(). This has been fixed by using a dedicated deinit function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/oggenc: free buffered page lists while uninitializing the muxerJames Almer2019-10-21
| | | | | | | If the trailer is never writen, there could be buffered pages that would leak. Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/flacenc: add a deinit functionJames Almer2019-10-21
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mp3enc: add init and deinit functionsJames Almer2019-10-21
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/ttaenc: add a deinit functionJames Almer2019-10-21
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/avienc: add deinit functionJames Almer2019-10-21
| | | | | | | Fixes ticket #8302 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: call AVOutputFormat->deinit() when freeing the contextJames Almer2019-10-21
| | | | | | | | | | | | Despite the doxy stating that it's called when the muxer is destroyed, this was not true in practice. It's only called by av_write_trailer() and on init() failure. An AVFormatContext may be closed without writing the trailer if errors ocurred while muxing packets, so in order to prevent memory leaks, it should effectively be called when freeing the muxer. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/pjsdec: Check duration for overflowMichael Niedermayer2019-10-20
| | | | | | | | Fixes: signed integer overflow: -3 - 9223372036854775807 cannot be represented in type 'long' Fixes: 17828/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5645915116797952 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/options: don't call avformat_free_context() within ↵James Almer2019-10-19
| | | | | | | | | avformat_alloc_context() avformat_free_context() expects AVFormatContext->internal to not be NULL. Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/nutenc: free all missing dynamic AVIOContext on header writing failureJames Almer2019-10-19
| | | | | | Fixes part of ticket #8316 Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/sapdec: check av_strdup() return value and fix memleakSteven Liu2019-10-19
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/mvdec: check av_strdup() return valueSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/mtv: check av_strdup() return valueSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/mpeg: check av_strdup() return valueSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/libsrt: check av_strdup() return value and fix memleakSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: check av_strdup() return valueSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/cinedec: check av_strdup() return valueSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/mpegenc: check for stream private data during deinitJames Almer2019-10-18
| | | | | | Prevents pointer dereferences when streams were not fully initialized. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/nutenc: don't allocate a dynamic AVIOContext if no index is going ↵James Almer2019-10-18
| | | | | | | | to be written Fixes ticket #8295 Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/hlsenc: fix memory leakJun Zhao2019-10-18
| | | | | | | fix memory leak Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>