ffmpeg.git
5 weeks agoavutil/avstring: support input path as a null pointer or empty string
Limin Wang [Tue, 24 Sep 2019 11:23:58 +0000 (19:23 +0800)]
avutil/avstring: support input path as a null pointer or empty string

Linux and OSX systems support basename and dirname via <libgen.h>, I plan to
make the wrapper interface conform to the standard interface first.
If it is feasible, I will continue to modify it to call the system interface
if there is already a system call interface.

You can get more description about the system interface by below command:
 "man 3 basename"

Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 weeks agoavfilter/vf_pad: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:12:43 +0000 (15:12 +0800)]
avfilter/vf_pad: add logging context to log

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavfilter/boxblur: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:11:50 +0000 (15:11 +0800)]
avfilter/boxblur: add logging context to log

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavfilter/vf_scale_qsv: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:10:36 +0000 (15:10 +0800)]
avfilter/vf_scale_qsv: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavfilter/vf_crop: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:08:33 +0000 (15:08 +0800)]
avfilter/vf_crop: add logging context to log

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavcodec/pngdec: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:07:19 +0000 (15:07 +0800)]
avcodec/pngdec: add logging context to log

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavcodec/videotoolbox: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:04:41 +0000 (15:04 +0800)]
avcodec/videotoolbox: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavcodec/mpegvideo_enc: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:03:04 +0000 (15:03 +0800)]
avcodec/mpegvideo_enc: add logging context to log

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavformat/mms: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:50:28 +0000 (14:50 +0800)]
avformat/mms: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavformat/mmst: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:47:57 +0000 (14:47 +0800)]
avformat/mmst: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavformat/network: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:41:06 +0000 (14:41 +0800)]
avformat/network: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavformat/avidec: add logging context to log
Steven Liu [Wed, 2 Oct 2019 06:44:47 +0000 (14:44 +0800)]
avformat/avidec: add logging context to log

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavformat/rtmpptoto: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:36:52 +0000 (14:36 +0800)]
avformat/rtmpptoto: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavformat/udp: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:34:17 +0000 (14:34 +0800)]
avformat/udp: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoavformat/hlsenc: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:31:36 +0000 (14:31 +0800)]
avformat/hlsenc: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 weeks agoChange libvpxenc default to crf=32.
elliottk [Tue, 24 Sep 2019 23:24:13 +0000 (16:24 -0700)]
Change libvpxenc default to crf=32.

Current default is 200kbps, which produces inconsistent
results (too high for low-res, too low for hi-res). Use
CRF instead, which will adapt. Affects VP9. Also have
VP8 use a default bitrate of 256kbps.

Signed-off-by: James Zern <jzern@google.com>
6 weeks agolavfi/normalize: remove the unused pointer
Zhong Li [Sun, 29 Sep 2019 08:05:51 +0000 (16:05 +0800)]
lavfi/normalize: remove the unused pointer

Signed-off-by: Zhong Li <zhong.li@intel.com>
6 weeks agolavc/qsv: fix a memory leak in ff_qsv_set_display_handle()
Zhong Li [Sun, 29 Sep 2019 08:01:06 +0000 (16:01 +0800)]
lavc/qsv: fix a memory leak in ff_qsv_set_display_handle()

Reported-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
6 weeks agoavcodec/flac_parser: Cosmetics
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:20 +0000 (07:01 +0200)]
avcodec/flac_parser: Cosmetics

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavcodec/flac_parser: Don't leave stale pointer in memory
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:19 +0000 (07:01 +0200)]
avcodec/flac_parser: Don't leave stale pointer in memory

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavcodec/flac_parser: Don't modify size of the input buffer
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:18 +0000 (07:01 +0200)]
avcodec/flac_parser: Don't modify size of the input buffer

When flushing, MAX_FRAME_HEADER_SIZE bytes (always zero) are supposed to
be written to the fifo buffer in order to be able to check the rest of
the buffer for frame headers. It was intended to write these by writing
a small buffer of size MAX_FRAME_HEADER_SIZE to the buffer. But the way
it was actually done ensured that this did not happen:

First, it would be checked whether the size of the input buffer was zero,
in which case it buf_size would be set to MAX_FRAME_HEADER_SIZE and
read_end would be set to indicate that MAX_FRAME_HEADER_SIZE bytes need
to be written. Then it would be made sure that there is enough space in
the fifo for the data to be written. Afterwards the data is written. The
check used here is for whether buf_size is zero or not. But if it was
zero initially, it is MAX_FRAME_HEADER_SIZE now, so that not the
designated buffer for writing MAX_FRAME_HEADER_SIZE is written; instead
the padded buffer (from the stack of av_parser_parse2()) is used. This
works because AV_INPUT_BUFFER_PADDING_SIZE >= MAX_FRAME_HEADER_SIZE.
Lateron, buf_size is set to zero again.

Given that since 7edbd536, the actual amount of data read is no longer
automatically equal to buf_size, it is completely unnecessary to modify
buf_size at all. Moreover, modifying it is dangerous: Some allocations
can fail and because buf_size is never reset to zero in this codepath,
the parser might return a value > 0 on flushing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavcodec/flac_parser: Remove superfluous checks
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:17 +0000 (07:01 +0200)]
avcodec/flac_parser: Remove superfluous checks

For a parser, the input buffer is always != NULL: In case of flushing,
the indicated size of the input buffer will be zero and the input buffer
will point to a zeroed buffer of size 0 + AV_INPUT_BUFFER_PADDING.
Therefore one does not need to check for whether said buffer is NULL or
not.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavcodec/flac_parser: Fix number of buffered headers
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:16 +0000 (07:01 +0200)]
avcodec/flac_parser: Fix number of buffered headers

Only decrement the number of buffered headers if a header has actually
been freed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavcodec/flac_parser: Fix off-by-one error
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:15 +0000 (07:01 +0200)]
avcodec/flac_parser: Fix off-by-one error

The flac parser uses a fifo to buffer its data. Consequently, when
searching for sync codes of flac packets, one needs to take care of
the possibility of wraparound. This is done by using an optimized start
code search that works on each of the continuous buffers separately and
by explicitly checking whether the last pre-wrap byte and the first
post-wrap byte constitute a valid sync code.

Moreover, the last MAX_FRAME_HEADER_SIZE - 1 bytes ought not to be searched
for (the start of) a sync code because a header that might be found in this
region might not be completely available. These bytes ought to be searched
lateron when more data is available or when flushing.

Unfortunately there was an off-by-one error in the calculation of the
length to search of the post-wrap buffer: It was too large, because the
calculation was based on the amount of bytes available in the fifo from
the last pre-wrap byte onwards. This meant that a header might be
parsed twice (once prematurely and once regularly when more data is
available); it could also mean that an invalid header will be treated as
valid (namely if the length of said invalid header is
MAX_FRAME_HEADER_SIZE and the invalid byte that will be treated as the
last byte of this potential header happens to be the right CRC-8).

Should a header be parsed twice, the second instance will be the best child
of the first instance; the first instance's score will be
FLAC_HEADER_BASE_SCORE - FLAC_HEADER_CHANGED_PENALTY ( = 3) higher than
the second instance's score. So the frame belonging to the first
instance will be output and it will be done as a zero length frame (the
difference of the header's offset and the child's offset). This has
serious consequences when flushing, as returning a zero length buffer
signals to the caller that no more data will be output; consequently the
last frames not yet output will be dropped.

Furthermore, a "sample/frame number mismatch in adjacent frames" warning
got output when returning the zero-length frame belonging to the first
header, because the child's sample/frame number of course didn't match
the expected sample frame/number given its parent.

filter/hdcd-mix.flac from the FATE-suite was affected by this (the last
frame was omitted) which is the reason why several FATE-tests needed to
be updated.

Fixes ticket #5937.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavcodec/flac_parser: Don't allocate array separately
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:14 +0000 (07:01 +0200)]
avcodec/flac_parser: Don't allocate array separately

The FLACHeaderMarker structure contained a pointer to an array of int;
said array was always allocated and freed at the same time as its
referencing FLACHeaderMarker; the pointer was never modified to point to
a different array and each FLACHeaderMarker had its own unique array.
Furthermore, all these arrays had a constant size. Therefore include
this array in the FLACHeaderMarker struct.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavcodec/flac_parser: Use native endianness when possible
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:13 +0000 (07:01 +0200)]
avcodec/flac_parser: Use native endianness when possible

FLAC sync codes contain a byte equal to 0xFF and so the function that
searches for sync codes first searched for this byte. It did this by
checking four bytes at once; these bytes have been read via AV_RB32, but
the test works just as well with native endianness.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/flac_picture: Avoid allocation of AVIOContext
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:12 +0000 (07:01 +0200)]
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>
6 weeks agodoc/formats: Update documentation for chromaprint
Andriy Gelman [Sun, 6 Oct 2019 05:49:47 +0000 (01:49 -0400)]
doc/formats: Update documentation for chromaprint

Silence detection can only be set with algorithm version 3.

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
6 weeks agoavcodec/filter: Remove extra '; ' outside of functions
Andreas Rheinhardt [Mon, 7 Oct 2019 00:10:30 +0000 (02:10 +0200)]
avcodec/filter: Remove extra '; ' outside of functions

They are not allowed outside of functions. Fixes the warning
"ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]"
when compiling with GCC and -pedantic.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavfilter/af_adelay: add option which changes how unset channels are delayed
Paul B Mahol [Mon, 7 Oct 2019 16:02:50 +0000 (18:02 +0200)]
avfilter/af_adelay: add option which changes how unset channels are delayed

Fixes #8032.

6 weeks agoavfilter/formats: guard against double free
Paul B Mahol [Mon, 7 Oct 2019 15:26:59 +0000 (17:26 +0200)]
avfilter/formats: guard against double free

6 weeks agoavfilter/vf_normalize: typedef all structs
Paul B Mahol [Mon, 7 Oct 2019 10:17:14 +0000 (12:17 +0200)]
avfilter/vf_normalize: typedef all structs

6 weeks agoavfilter/vf_showpalette: remove timeline flag
Paul B Mahol [Mon, 7 Oct 2019 10:07:00 +0000 (12:07 +0200)]
avfilter/vf_showpalette: remove timeline flag

This filter changes output size and thus can not have support
for timeline.

6 weeks agoavfilter/af_afftfilt: fix possible invalid memory access
Paul B Mahol [Mon, 7 Oct 2019 09:37:05 +0000 (11:37 +0200)]
avfilter/af_afftfilt: fix possible invalid memory access

6 weeks agoavfilter/vf_nnedi: fix possible double free
Paul B Mahol [Mon, 7 Oct 2019 09:10:45 +0000 (11:10 +0200)]
avfilter/vf_nnedi: fix possible double free

6 weeks agodoc/filters: fix few more typos
Paul B Mahol [Sun, 6 Oct 2019 18:31:43 +0000 (20:31 +0200)]
doc/filters: fix few more typos

6 weeks agoavformat/subtitles: Check nb_subs in ff_subtitles_queue_finalize()
Michael Niedermayer [Fri, 4 Oct 2019 15:10:38 +0000 (17:10 +0200)]
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>
6 weeks agoavcodec/h2645_parse: Use av_fast_realloc() for nals array
Michael Niedermayer [Sat, 5 Oct 2019 16:19:39 +0000 (18:19 +0200)]
avcodec/h2645_parse: Use av_fast_realloc() for nals array

Fixes: Timeout (17sec ->281ms)
Fixes: 17833/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5638346914660352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/cinepakenc: Fix invalid shifts
Andreas Rheinhardt [Sun, 6 Oct 2019 05:23:14 +0000 (07:23 +0200)]
avcodec/cinepakenc: Fix invalid shifts

Fixes: left shift of 1 by 31 places cannot be represented in type 'int'.
Affected the FATE-tests vsynth1-cinepak, vsynth2-cinepak and
vsynth_lena-cinepak. Also fixes ticket #8220.

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>
6 weeks agoavformat/mpjpegdec: Avoid allocation of AVIOContext
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:11 +0000 (07:01 +0200)]
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>
6 weeks agoavformat/matroskaenc: use r_frame_rate as fallback to set a track's DefaultDuration
James Almer [Tue, 1 Oct 2019 15:58:20 +0000 (12:58 -0300)]
avformat/matroskaenc: use r_frame_rate as fallback to set a track's DefaultDuration

Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agoavfilter/vf_avgblur: add support for commands
Paul B Mahol [Sun, 6 Oct 2019 13:44:20 +0000 (15:44 +0200)]
avfilter/vf_avgblur: add support for commands

6 weeks agoavfilter/vf_gblur: add support for commands
Paul B Mahol [Sun, 6 Oct 2019 13:23:55 +0000 (15:23 +0200)]
avfilter/vf_gblur: add support for commands

6 weeks agoavfilter: add anlms filter
Paul B Mahol [Thu, 3 Oct 2019 16:09:59 +0000 (18:09 +0200)]
avfilter: add anlms filter

6 weeks agodoc/codecs: Update documentation for flags/flags2
Jun Zhao [Fri, 4 Oct 2019 12:43:27 +0000 (20:43 +0800)]
doc/codecs: Update documentation for flags/flags2

Update documentation for flags/flags2

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
6 weeks agolavc/options_table: Correct the flags for AVCodecContext.flags2
Jun Zhao [Fri, 4 Oct 2019 12:32:00 +0000 (20:32 +0800)]
lavc/options_table: Correct the flags for AVCodecContext.flags2

Correct the flags for AVCodecContext.flags2.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
6 weeks agoavcodec/decode: fix indentation
Jun Zhao [Fri, 4 Oct 2019 12:22:15 +0000 (20:22 +0800)]
avcodec/decode: fix indentation

fix indentation.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
6 weeks agoavutil/common: Fix underflow for ROUNDED_DIV with unsigned integer
Mengye Lv [Wed, 2 Oct 2019 02:30:45 +0000 (10:30 +0800)]
avutil/common: Fix underflow for ROUNDED_DIV with unsigned integer

When used ROUNDED_DIV(a,b), if a is unsigned integer zero, it's
will lead to an underflow issue(it called unsigned integer
wrapping).

Fixes #8062

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Mengye Lv <mengyelv@tencent.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
6 weeks agoavformat/matroskadec: don't rescale mastering display values
James Almer [Thu, 3 Oct 2019 23:52:20 +0000 (20:52 -0300)]
avformat/matroskadec: don't rescale mastering display values

Simplifies code.

Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agoavformat/mpeg: better fix for MLP versus PCM-DVD misdetection
Paul B Mahol [Tue, 1 Oct 2019 09:34:09 +0000 (11:34 +0200)]
avformat/mpeg: better fix for MLP versus PCM-DVD misdetection

6 weeks agoFATE/dnn: fix stack buffer overflow
Zhao Zhili [Tue, 1 Oct 2019 06:36:49 +0000 (14:36 +0800)]
FATE/dnn: fix stack buffer overflow

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
6 weeks agoswscale: Fix AltiVec/VSX build with recent GCC
Daniel Kolesa [Wed, 7 Aug 2019 17:39:07 +0000 (19:39 +0200)]
swscale: Fix AltiVec/VSX build with recent GCC

The argument to vec_splat_u16 must be a literal. By making the
function always inline and marking the arguments const, gcc can
turn those into literals, and avoid build errors like:

swscale_vsx.c:165:53: error: argument 1 must be a 5-bit signed literal

Fixes #7861.

Signed-off-by: Daniel Kolesa <daniel@octaforge.org>
Signed-off-by: Lauri Kasanen <cand@gmx.com>
6 weeks agoswscale: Replace illegal vector keyword usage in altivec code
Daniel Kolesa [Wed, 7 Aug 2019 17:39:06 +0000 (19:39 +0200)]
swscale: Replace illegal vector keyword usage in altivec code

While this technically compiles in current ffmpeg, this is only
because ffmpeg is compiled in strict ISO C mode, which disables
the builtin 'vector' keyword for AltiVec/VSX. Instead this gets
replaced with a macro inside altivec.h, which defines vector to
be actually __vector, which accepts random types.

Normally, the vector keyword should be used only with plain
scalar non-typedef types, such as unsigned int. But we have the
vec_(s|u)(8|16|32) macros, which can be used in a portable manner,
in util_altivec.h in libavutil.

This is also consistent with other AltiVec/VSX code elsewhere in
the tree.

Fixes #7861.

Signed-off-by: Daniel Kolesa <daniel@octaforge.org>
Signed-off-by: Lauri Kasanen <cand@gmx.com>
6 weeks agoavformat/matroskadec: Fix demuxing ProRes
Andreas Rheinhardt [Sat, 28 Sep 2019 17:54:25 +0000 (19:54 +0200)]
avformat/matroskadec: Fix demuxing ProRes

The structure of a ProRes frame in mov/mp4 is that of a typical atom:
First a 32 bit BE size field, then a tag detailling the content. Said
size field includes the eight bytes of the atom header.

This header is actually redundant, as the size of the atom is already
known from the containing atom. It is therefore stripped away when muxed
into Matroska and so the Matroska demuxer has to recreate upon demuxing.
But it did not account for the fact that the size field includes the
size of the header and this can lead to problems when a decoder uses the
in-band size field.

Fixes ticket #8210.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agoavcodec/tiff: Set FF_CODEC_CAP_INIT_CLEANUP
Michael Niedermayer [Wed, 2 Oct 2019 19:14:17 +0000 (21:14 +0200)]
avcodec/tiff: Set FF_CODEC_CAP_INIT_CLEANUP

Fixes: memleaks
Fixes: 17813/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5145600206569472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/vc1_block: Fix invalid left shift in vc1_decode_p_mb()
Michael Niedermayer [Wed, 2 Oct 2019 17:53:44 +0000 (19:53 +0200)]
avcodec/vc1_block: Fix invalid left shift in vc1_decode_p_mb()

Fixes: left shift of negative value -6
Fixes: 17810/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5638541240958976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/wmaprodec: Check if there is a stream
Michael Niedermayer [Wed, 2 Oct 2019 17:26:51 +0000 (19:26 +0200)]
avcodec/wmaprodec: Check if there is a stream

Fixes: null pointer dereference
Fixes: signed integer overflow: 512 * 2147483647 cannot be represented in type 'int'
Fixes: 17809/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5634409947987968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavformat/aiffenc: Remove wrong and redundant check
Andreas Rheinhardt [Wed, 2 Oct 2019 04:04:12 +0000 (06:04 +0200)]
avformat/aiffenc: Remove wrong and redundant check

The check "if (!pb->seekable & AVIO_SEEKABLE_NORMAL)" is wrong, because
! has higher precendence than &. But it is also redundant, because this
part of the code is only ever reached when the AVIO_SEEKABLE_NORMAL flag
is set for pb. So simply remove the check.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavformat/aiffenc: Fix potential memleak upon failure
Andreas Rheinhardt [Wed, 2 Oct 2019 04:04:11 +0000 (06:04 +0200)]
avformat/aiffenc: Fix potential memleak upon failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavformat/aiffenc: Use standard packet list functions
Andreas Rheinhardt [Wed, 2 Oct 2019 04:04:10 +0000 (06:04 +0200)]
avformat/aiffenc: Use standard packet list functions

Up until now, aiffenc didn't rely on the standard functions for adding
an element to a linked list and freeing the list, but instead
reimplemented them. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agodoc/filters: fix typo
Paul B Mahol [Thu, 3 Oct 2019 15:58:46 +0000 (17:58 +0200)]
doc/filters: fix typo

6 weeks agoavfilter/vsrc_sierpinski: add triangle type
Paul B Mahol [Thu, 3 Oct 2019 12:21:39 +0000 (14:21 +0200)]
avfilter/vsrc_sierpinski: add triangle type

6 weeks agoavfilter: add av_cold where it is missing
Paul B Mahol [Thu, 3 Oct 2019 10:09:07 +0000 (12:09 +0200)]
avfilter: add av_cold where it is missing

6 weeks agoavfilter/f_streamselect: fix memleaks of pad names
Paul B Mahol [Thu, 3 Oct 2019 09:23:23 +0000 (11:23 +0200)]
avfilter/f_streamselect: fix memleaks of pad names

6 weeks agoavfilter/af_amix: fix filtering if specified weights are negative
Paul B Mahol [Thu, 3 Oct 2019 08:27:56 +0000 (10:27 +0200)]
avfilter/af_amix: fix filtering if specified weights are negative

6 weeks agoavfilter/setpts: switch to activate
Paul B Mahol [Mon, 30 Sep 2019 11:53:59 +0000 (13:53 +0200)]
avfilter/setpts: switch to activate

Also properly handle EOF timestamps.
Fixes #6833.

6 weeks agoavcodec/g2meet: Check for end of input in jpg_decode_block()
Michael Niedermayer [Mon, 9 Sep 2019 18:30:32 +0000 (20:30 +0200)]
avcodec/g2meet: Check for end of input in jpg_decode_block()

Fixes: Timeout (100sec -> 0.7sec)
Fixes: 8668/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5174143888130048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/g2meet: Check if adjusted pixel was on the stack
Michael Niedermayer [Mon, 9 Sep 2019 18:05:09 +0000 (20:05 +0200)]
avcodec/g2meet: Check if adjusted pixel was on the stack

This basically checks if a pixel that was coded with prediction
and residual could have been stored using a previous case.
This avoids basically a string of 0 symbols stored in less than
50 bytes to hit a O(n²) codepath.

Fixes: Timeout (too slow to wait -> immediately)
Fixes: 8668/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-4895946310680576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavfilter/vf_elbg: stop leaking frame on error
Paul B Mahol [Wed, 2 Oct 2019 08:54:45 +0000 (10:54 +0200)]
avfilter/vf_elbg: stop leaking frame on error

6 weeks agoavformat/electronicarts: If no packet has been read at the end do not treat it as...
Michael Niedermayer [Mon, 30 Sep 2019 21:42:41 +0000 (23:42 +0200)]
avformat/electronicarts: If no packet has been read at the end do not treat it as if theres a packet

Fixes: Assertion failure
Fixes: 17770/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5700606668308480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agolavc/x264: Use FF_CODEC_CAP_INIT_THREADSAFE if x264 is new.
Carl Eugen Hoyos [Sun, 25 Aug 2019 14:12:28 +0000 (16:12 +0200)]
lavc/x264: Use FF_CODEC_CAP_INIT_THREADSAFE if x264 is new.

Usage of strtok() was removed from x264, see also b02490a4

6 weeks agolavfi/movie: Use filter thread count for decoding threads.
Carl Eugen Hoyos [Sun, 25 Aug 2019 16:42:02 +0000 (18:42 +0200)]
lavfi/movie: Use filter thread count for decoding threads.

Fixes ticket #7542.

6 weeks agocmdutils: trailing options may be ignored
Lou Logan [Fri, 27 Sep 2019 20:19:24 +0000 (12:19 -0800)]
cmdutils: trailing options may be ignored

Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: mypopy <mypopy@gmail.com>
6 weeks agoavfilter/vf_drawbox: implement process_command
Paul B Mahol [Tue, 1 Oct 2019 18:17:50 +0000 (20:17 +0200)]
avfilter/vf_drawbox: implement process_command

6 weeks agoavfilter/vf_drawbox: reduce code duplication
Paul B Mahol [Tue, 1 Oct 2019 17:22:17 +0000 (19:22 +0200)]
avfilter/vf_drawbox: reduce code duplication

6 weeks agolavf/avio: Print https warning also for avio_find_protocol_name().
Carl Eugen Hoyos [Wed, 25 Sep 2019 09:32:57 +0000 (11:32 +0200)]
lavf/avio: Print https warning also for avio_find_protocol_name().

Helps to fix ticket #8197.

6 weeks agoavfilter/f_streamselect: add check case when nothing is done
Paul B Mahol [Tue, 1 Oct 2019 16:46:20 +0000 (18:46 +0200)]
avfilter/f_streamselect: add check case when nothing is done

Fixes #7955.

6 weeks agoavfilter/vsink_nullsink: cosmetics
Paul B Mahol [Tue, 1 Oct 2019 12:57:41 +0000 (14:57 +0200)]
avfilter/vsink_nullsink: cosmetics

6 weeks agoavfilter/copy: add forgotten check
Paul B Mahol [Tue, 1 Oct 2019 12:55:43 +0000 (14:55 +0200)]
avfilter/copy: add forgotten check

6 weeks agoavfilter/asink_anullsink: cosmetics
Paul B Mahol [Tue, 1 Oct 2019 12:38:58 +0000 (14:38 +0200)]
avfilter/asink_anullsink: cosmetics

6 weeks agoavfilter/vf_copy: check for error cases and handle them
Paul B Mahol [Tue, 1 Oct 2019 11:45:29 +0000 (13:45 +0200)]
avfilter/vf_copy: check for error cases and handle them

6 weeks agoavfilter/af_acopy: check for error cases and handle them
Paul B Mahol [Tue, 1 Oct 2019 11:42:18 +0000 (13:42 +0200)]
avfilter/af_acopy: check for error cases and handle them

6 weeks agoavfilter/vf_showpalette: fix small cosmetics issue
Paul B Mahol [Tue, 1 Oct 2019 11:24:35 +0000 (13:24 +0200)]
avfilter/vf_showpalette: fix small cosmetics issue

6 weeks agoavfilter/vf_alphamere: use the name 's' for the pointer to the private context
Paul B Mahol [Tue, 1 Oct 2019 11:17:43 +0000 (13:17 +0200)]
avfilter/vf_alphamere: use the name 's' for the pointer to the private context

This is shorter and consistent across filters.

7 weeks agoavcodec/dxv: Check op_offset in dxv_decompress_yo()
Michael Niedermayer [Mon, 30 Sep 2019 06:02:11 +0000 (08:02 +0200)]
avcodec/dxv: Check op_offset in dxv_decompress_yo()

Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int'
Fixes: 17745/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5734628463214592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavcodec/utils: Check sample_rate before opening the decoder
Michael Niedermayer [Fri, 27 Sep 2019 10:31:39 +0000 (12:31 +0200)]
avcodec/utils: Check sample_rate before opening the decoder

Fixes: signed integer overflow: 2 * -1306460384 cannot be represented in type 'int'
Fixes: 17685/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_fuzzer-5747390337777664
Fixes: 17688/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5739287210885120
Fixes: 17699/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5678394531905536
Fixes: 17738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5763415733174272
Fixes: 17746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_RDFT_fuzzer-5703008159006720

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavcodec/aptx: Fix multiple shift anomalies
Michael Niedermayer [Fri, 27 Sep 2019 16:36:16 +0000 (18:36 +0200)]
avcodec/aptx: Fix multiple shift anomalies

Fixes: left shift of negative value -24576
Fixes: 17719/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APTX_fuzzer-5710508002377728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavfilter/vf_photosensitivity: fix memleak
Paul B Mahol [Mon, 30 Sep 2019 18:37:25 +0000 (20:37 +0200)]
avfilter/vf_photosensitivity: fix memleak

7 weeks agolibavfilter: add photosensitivity filter
Vladimir Panteleev [Fri, 8 Mar 2019 06:47:42 +0000 (06:47 +0000)]
libavfilter: add photosensitivity filter

7 weeks agoavfilter: add scroll video filter
Paul B Mahol [Sun, 29 Sep 2019 10:43:32 +0000 (12:43 +0200)]
avfilter: add scroll video filter

7 weeks agoavfilter/af_join: cosmetics
Paul B Mahol [Mon, 30 Sep 2019 14:52:52 +0000 (16:52 +0200)]
avfilter/af_join: cosmetics

7 weeks agoavfilter/af_join: use av_asprintf()
Paul B Mahol [Mon, 30 Sep 2019 14:45:31 +0000 (16:45 +0200)]
avfilter/af_join: use av_asprintf()

7 weeks agoavfilter/split: use av_asprintf()
Paul B Mahol [Mon, 30 Sep 2019 14:39:39 +0000 (16:39 +0200)]
avfilter/split: use av_asprintf()

7 weeks agoavfilter/trim: drop all audio frames instead of asserting
Paul B Mahol [Mon, 30 Sep 2019 10:57:26 +0000 (12:57 +0200)]
avfilter/trim: drop all audio frames instead of asserting

7 weeks agoavfilter/f_metadata: do not memleak expr
Paul B Mahol [Mon, 30 Sep 2019 10:24:06 +0000 (12:24 +0200)]
avfilter/f_metadata: do not memleak expr

7 weeks agoavfilter/f_metadata: add ends_with() function for comparing ends of strings
Paul B Mahol [Mon, 30 Sep 2019 10:13:46 +0000 (12:13 +0200)]
avfilter/f_metadata: add ends_with() function for comparing ends of strings

7 weeks agolavf/utils: support duration estimate method dump
Jun Zhao [Sun, 29 Sep 2019 03:58:43 +0000 (11:58 +0800)]
lavf/utils: support duration estimate method dump

add new function duration_estimate_name to dump duration estimate
method, it's will help to debug some duration issue.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
7 weeks agolavf/utils: Cosmetics: fix indentation for estimate_timings
Jun Zhao [Sat, 28 Sep 2019 03:01:54 +0000 (11:01 +0800)]
lavf/utils: Cosmetics: fix indentation for estimate_timings

fix indentation for estimate_timings when dump start_time/duartion.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
7 weeks agolavf/utils: correct the duration estimation method for nut demuxer
Jun Zhao [Sat, 28 Sep 2019 02:45:31 +0000 (10:45 +0800)]
lavf/utils: correct the duration estimation method for nut demuxer

in fact, nut demuxer use the PTS for duration estimation.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
7 weeks agolavf/nutdec: add logging context to log
Jun Zhao [Sat, 28 Sep 2019 02:21:11 +0000 (10:21 +0800)]
lavf/nutdec: add logging context to log

Add logging context to log, it's will help debuging.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>