Commit Graph

21874 Commits

Author SHA1 Message Date
James Almer a581bb66ea avformat/avienc: add deinit function
Fixes ticket #8302

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-21 17:20:20 -03:00
James Almer 02cf239196 avformat: call AVOutputFormat->deinit() when freeing the context
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>
2019-10-21 17:20:20 -03:00
Michael Niedermayer 1efaac6932 avformat/pjsdec: Check duration for overflow
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>
2019-10-20 19:57:51 +02:00
James Almer 31aafdac24 avformat/options: don't call avformat_free_context() within 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>
2019-10-19 21:29:36 -03:00
James Almer 90e37adab7 avformat/nutenc: free all missing dynamic AVIOContext on header writing failure
Fixes part of ticket #8316

Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-19 14:42:23 -03:00
Steven Liu 9f023017ab avformat/sapdec: check av_strdup() return value and fix memleak
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-19 06:56:52 +02:00
Steven Liu b1071b405d avformat/mvdec: check av_strdup() return value
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-19 06:56:02 +02:00
Steven Liu 53928e0b49 avformat/mtv: check av_strdup() return value
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-19 06:54:53 +02:00
Steven Liu f5263172de avformat/mpeg: check av_strdup() return value
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-19 06:54:12 +02:00
Steven Liu 1f7b527194 avformat/libsrt: check av_strdup() return value and fix memleak
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-19 06:49:46 +02:00
Steven Liu 17d96c15d2 avformat/hlsenc: check av_strdup() return value
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-19 06:48:49 +02:00
Steven Liu 25f5d67a31 avformat/cinedec: check av_strdup() return value
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-19 06:47:10 +02:00
James Almer 0700e7247b avformat/mpegenc: check for stream private data during deinit
Prevents pointer dereferences when streams were not fully initialized.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-18 23:14:40 -03:00
James Almer 1d479300cb avformat/nutenc: don't allocate a dynamic AVIOContext if no index is going to be written
Fixes ticket #8295

Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-18 20:53:10 -03:00
Jun Zhao feaec3bc31 lavf/hlsenc: fix memory leak
fix memory leak

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-10-18 09:58:50 +08:00
Andreas Rheinhardt b288a7eb3d avformat/mpegenc: Fix memleaks and return values
If there is an error in mpeg_mux_init() (the write_header function of
the various MPEG-PS muxers), two things might happen:

1. Several fifos might leak. Instead of freeing them, the goto fail part
of the functions freed the private data of the AVStreams instead,
although this will be freed later in free_stream() anyway.
2. And if the function is exited via goto fail, it automatically
returned AVERROR(ENOMEM), although this is also used when the error is
not a memory allocation failure.

Both of these issues happened in ticket #8284 and have been fixed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-17 18:04:37 +02:00
Michael Niedermayer ea770eb559 avformat/shortendec: Check k in probe
Fixes: Assertion failure
Fixes: 17640/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5708767475269632

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-16 19:17:57 +02:00
Andriy Gelman e14f5fd0a6 avformat/chromaprint: Fix writing raw fingerprint
The pointer fp after the call to chromaprint_get_raw_fingerpoint() points to an array
of uint32_t whereas the current code assumed just a char stream. Thus when writing the
raw fingerprint, the output would be truncated by a factor of 4.

For reference the declaration of the function from chromaprint.h is:
int chromaprint_get_raw_fingerprint(ChromaprintContext *ctx, uint32_t **fingerprint, int *size);
2019-10-16 10:34:51 +05:30
James Almer dd01947397 avformat/latmenc: abort if no extradata is available
Fixes ticket #8273.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-15 13:04:44 -03:00
Andriy Gelman 634529c40d avformat/chromaprint: improve logging message
Setting silence_threshold requires that -algorithm is set to 3.
2019-10-14 12:29:40 +05:30
Andriy Gelman 1108bd5173 avformat/chromaprint: Fix fp_format option
The fp_format option was incorrectly declared,
so it could not be set via string constants.
2019-10-14 12:27:34 +05:30
Andreas Rheinhardt 5056eb3511 avformat/Makefile: Fix aiffdec replaygain dependency
Forgotten in 6390f52a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-14 00:48:44 +02:00
Matthieu Bouron 1921f866ec avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly
Allows the creation of the sdtp atom while remuxing MP4 to MP4. This
atom is required by Apple devices (iPhone, Apple TV) in order to accept
2160p medias.
2019-10-12 14:36:15 +02:00
Moritz Barsnick f76a899abc avformat/mpjpegdec: ensure seekback for latest chunk
Not only the first, but each latest chunk must be cached to allow
seekback after finding the mime boundary.

Fixes trac #5023 and #5921.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-12 13:21:50 +02:00
Moritz Barsnick 1ea44a55fe avformat/mpjpegdec: fix strict boundary search string
According to RFC1341, the multipart boundary indicated by the
Content-Type header must be prepended by CRLF + "--", and followed
by CRLF. In the case of strict MIME header boundary handling, the
"--" was forgotten to add.

Fixes trac #7921.

A side effect is that this coincidentally breaks enforcement of
strict MIME headers against servers running motion < 3.4.1, where
the boundary announcement in the HTTP headers incorrectly used the
prefix "--", which exactly matched this bug's behavior.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-12 13:21:50 +02:00
Moritz Barsnick a3846fe69b avformat/mpjpegdec: fix finding multipart boundary parameter
The string matching function's return value was evaluated incorrectly.

Fixes trac #7920.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-12 13:21:50 +02:00
James Almer 72704cbff4 avformat/dv: free all allocated structs on dv_read_header failure
Also propagate proper AVERROR codes while at it.

Fixes ticket #8230.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-11 20:38:36 -03:00
Steven Liu 9f0b9ae8bd avformat/iff: fix memleak when get st->codecpar->extradata failed in iff_read_header
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-10 09:54:48 +08:00
Steven Liu 6f84c1e907 avformat/jvdec: fix memleak when read_header failed
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-10 09:54:42 +08:00
Raphaël Zumer 9d92403add avformat/ivfdec: Change the length field to 32 bits
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
2019-10-08 21:45:00 -04:00
Raphaël Zumer d3807467b2 avformat/ivfenc: Change the length fields to 32 bits
There is no change in the encoded bitstream, but this
ensures that the written field length is consistent
with the reference implementation.

Unused bytes are zeroed out for backwards compatibility.

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
2019-10-08 21:44:41 -04:00
Raphaël Zumer eeb1c515a8 avformat/ivfenc: Comment the length field encoding process
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
2019-10-08 21:44:36 -04:00
Michael Niedermayer 9a0d36e562 avformat/mpsubdec: Clear queue on error
Fixes: Memleaks
Fixes: 17219/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5720539124989952

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-08 16:24:58 +02:00
Andreas Rheinhardt ffb32d35ee avformat/mpeg: Remove set-but-unused variable
Forgotten in 7da57875.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-10-08 10:41:43 +02:00
vectronic e149be38a8 avformat/hls: fix missing segment offset reset on last segment when http_multiple is enabled.
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
2019-10-08 14:58:47 +08:00
vectronic b21c5ef501 avformat/hls: pass http offset options to http request
made with persistent connections to prevent incorrect reset of
offset when demuxing HLS+FMP4

Signed-off-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
2019-10-08 14:57:53 +08:00
vectronic e81c686a95 avformat/http: add ff_http_do_new_request2 for options
add ff_http_do_new_request2() which supports options to be applied to
HTTPContext after initialisation with the new uri

Signed-off-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
2019-10-08 14:57:44 +08:00
Limin Wang afab93ccd0 avformat/hlsenc: replace with av_freep for all av_free
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-08 14:12:56 +08:00
Limin Wang 28bb73cee7 avformat/hlsenc: replace with av_dirname to get the directory
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-08 14:12:53 +08:00
Limin Wang 61aa77272a avformat/hlsenc: remove the unnecessary null pointer check
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-08 14:12:49 +08:00
Steven Liu 8c16c133d0 avformat/mms: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:47:16 +08:00
Steven Liu cdf8253a06 avformat/mmst: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:47:12 +08:00
Steven Liu 4ff97342ce avformat/network: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:47:07 +08:00
Steven Liu 17236a2c40 avformat/avidec: add logging context to log
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:46:58 +08:00
Steven Liu 35236fd729 avformat/rtmpptoto: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:46:53 +08:00
Steven Liu 5db50dbf06 avformat/udp: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:46:42 +08:00
Steven Liu db99b32a1b avformat/hlsenc: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:46:32 +08:00
Andreas Rheinhardt 69dd8d3a2a avformat/flac_picture: Avoid allocation of AVIOContext
Put an AVIOContext whose lifetime doesn't extend beyond the function
where it is allocated on the stack instead of allocating and freeing it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-10-07 22:27:17 +02:00
Michael Niedermayer 81b53913bb avformat/subtitles: Check nb_subs in ff_subtitles_queue_finalize()
Fixes: null pointer dereference
Fixes: 17828/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5645915116797952
Fixes: Ticket8147

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-06 20:00:59 +02:00
Andreas Rheinhardt 670fd3b0ec avformat/mpjpegdec: Avoid allocation of AVIOContext
Put an AVIOContext whose lifetime doesn't extend beyond the function where
it is allocated on the stack instead of allocating and freeing it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-06 20:00:59 +02:00