1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

95181 Commits

Author SHA1 Message Date
Paul B Mahol
056bc9393e avfilter/vf_photosensitivity: fix memleak 2019-09-30 20:37:25 +02:00
Vladimir Panteleev
c888adf590 libavfilter: add photosensitivity filter 2019-09-30 20:21:27 +02:00
Paul B Mahol
a746359ede avfilter: add scroll video filter 2019-09-30 19:37:37 +02:00
Paul B Mahol
5161b279d6 avfilter/af_join: cosmetics 2019-09-30 16:52:52 +02:00
Paul B Mahol
7851e2f368 avfilter/af_join: use av_asprintf() 2019-09-30 16:45:31 +02:00
Paul B Mahol
6e9e14e62e avfilter/split: use av_asprintf() 2019-09-30 16:39:39 +02:00
Paul B Mahol
8b36968ef4 avfilter/trim: drop all audio frames instead of asserting 2019-09-30 12:58:06 +02:00
Paul B Mahol
a6e2cf5eb0 avfilter/f_metadata: do not memleak expr 2019-09-30 12:24:06 +02:00
Paul B Mahol
9c9d5bf257 avfilter/f_metadata: add ends_with() function for comparing ends of strings 2019-09-30 12:14:34 +02:00
Jun Zhao
6ca3d34ff8 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>
2019-09-30 10:08:45 +08:00
Jun Zhao
f5e867570e 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>
2019-09-30 10:08:27 +08:00
Jun Zhao
541c635628 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>
2019-09-30 10:08:16 +08:00
Jun Zhao
12e6057fb0 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>
2019-09-30 10:06:21 +08:00
Jun Zhao
79597639cb lavf/utils: change the log level to warning if can't get duration
change the log level to warning if can't get duration, it's will help
to debug some duration issue

Signed-off-by: vacingfang <vacingfang@tencent.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-30 10:06:09 +08:00
Michael Niedermayer
47b0d0812e tools/target_dec_fuzzer: Adjust VP7 threshold
Fixes: Timeout (110sec -> 10sec)
Fixes: 17705/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5765834135306240

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>
2019-09-29 22:18:58 +02:00
Paul B Mahol
f1e17eb446 avcodec/qtrleenc: fix undefined behaviour
Fixes #7991.
2019-09-29 21:05:35 +02:00
Paul B Mahol
4a51075f4d doc/examples/muxing: fix underflow in duration of encoded streams
Now they are exactly 10 seconds long.

Fixes #5684.
2019-09-29 20:41:29 +02:00
Andreas Rheinhardt
1929dd4eff avcodec/cbs_av1: Make overread check more robust
When performing a comparison of a signed int and an unsigned int, the
signed int is first converted to an unsigned int, so that negative
values are being treated as big, positive values. This can become a
problem in an overread check, namely when an overread already happened.
So change the type of the variable containing the amount of bits that
need to be left to signed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-29 17:48:40 +01:00
Andreas Rheinhardt
f3333c3c67 avcodec/cbs_h2645: Fix potential out-of-bounds array access
The maximum allowed index for an array access is FF_ARRAY_ELEMS - 1; yet
the current code allowed FF_ARRAY_ELEMS. This wasn't dangerous in practice,
as parameter sets with invalid ids were already filtered out during
reading.

Found via PVS-Studio (see ticket #8156).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-29 17:48:38 +01:00
James Almer
e3f0ecfc57 avcodec/fitsdec: fix use of uninitialised values
header.data_max and header.data_min are not necessarely set on all decoding scenarios.

Fixes a Valgrind reported regression since cfa1937791.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-29 12:44:43 -03:00
Andreas Rheinhardt
9fdc2c7bc4 avformat/utils: Remove unnecessary initializations
Up until now, read_frame_internal always initialized the packet it
received. But since the recent changes to ff_read_packet, this is no
longer needed: If the parsing queue is initially empty upon entering
read_frame_internal, the packet will now either contain content upon
success or be blank upon failure of ff_read_packet. If the parsing
queue is initially not empty, the packet will be overwritten with the
oldest one from the parsing queue.

Similarly, it is unnecessary to initialize ret in read_frame_internal.

In parse_packet, it is easily possible to only initialize the packet
used as temporary storage for the output if said packet is used at all;
furthermore, this packet doesn't need to be zero-initialized, because
av_init_packet will initialize every field except size and data and
those fields will be set by av_parser_parse2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:44 -03:00
Andreas Rheinhardt
5c95af6b7c avformat/utils: Improve parsing packets
Up until now, parse_packet() used a stack packet in case the stream is
flushed. But using such a packet is unnecessary as there is an AVPacket
readily available, it just needs to be used. Whether flushing is intended
or not will now be signalled by an explicit parameter rather than by
whether the packet parameter is NULL. This removes a few checks in
parse_packet(), gets rid of the initialization of the stack packet and
also reduces usage of sizeof(AVPacket) in libavformat.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:44 -03:00
Andreas Rheinhardt
cdba00ae11 avformat/utils: Avoid copying packets unnecessarily
Up until now, read_frame_internal in avformat/utils.c uses a spare
packet on the stack that serves no real purpose: At no point in this
function is there a need for another packet besides the packet destined
for output:
1. If the packet doesn't need a parser, but is output as is, the content
of the spare packet (that at this point contains a freshly read packet)
is simply copied into the output packet (via simple assignment, not
av_packet_move_ref, thereby confusing ownership).
2. If the packet needs parsing, the spare packet will be reset after
parsing and any packets resulting from the packet read will be put into
a packet list; the output packet is not used here at all.
3. If the stream should be discarded, the spare packet will be
unreferenced; the output packet is not used here at all either.

Therefore the spare packet and the copies can be removed in principle.
In practice, one more thing needs to be taken care of: If ff_read_packet
failed, the output packet was not affected, now it is. But given that
ff_read_packet returns a blank (as if reset via av_packet_unref) packet
on failure, there is no problem from this side either.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:44 -03:00
Andreas Rheinhardt
ada02cf85f avformat/utils: Don't create unnecessary references
When AVFMT_FLAG_GENPTS is set, av_read_frame would put a reference to a
packet in the packet list (via av_packet_ref) and then immediately
thereafter unreference the original packet. This has been changed to
move the reference instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:43 -03:00
Andreas Rheinhardt
bf79e4426a avformat/utils: Fix memleaks II
Up until now, avformat_find_stream_info had a potential for memleaks:
When everything was fine, it read packets and (depending upon whether
AVFMT_FLAG_NOBUFFER was set) put them in a packet list or unreferenced
them when they were no longer needed. But upon failure, said packets
would leak if they were not already on the packet list. This patch fixes
this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:43 -03:00
Andreas Rheinhardt
47a4528abc avformat/utils: Don't initialize in loops
Since the recent changes to ff_packet_list_put, the source packet will
be automatically reset when the reference is moved to the packet list,
so that it is unnecessary to reinitialize the packet in the loops in
parse_packet and ff_read_packet; initializing once at the beginning is
enough.

This also fixes a potential, but currently unexisting problem: If the
raw packet buffer was initially not empty and probe_codec() failed,
then the packet returned would not be initialized. But given that
probe_codec() currently can't fail (always returns 0) this was not an
acute danger.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:43 -03:00
Paul B Mahol
551e8dc145 doc/filters: add more advanced silenceremove example 2019-09-28 23:04:07 +02:00
Paul B Mahol
947e8ab329 avfilter/fifo: use the name 's' for the pointer to the private context
This is shorter and consistent across filters.
2019-09-28 22:09:56 +02:00
Paul B Mahol
216830aca4 avfilter/fifo: cosmetics 2019-09-28 22:09:56 +02:00
Limin Wang
86f0411a52 avfilter/vf_framerate: remove duplicate code with macro-based function
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-09-28 21:53:55 +02:00
Limin Wang
fd5fdca953 avfilter/vf_framerate: refine the filter_slice code for better readiablity
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-09-28 20:20:28 +02:00
Limin Wang
b4e7d3a0db avfilter/vf_framerate: limit the scene level max range
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-09-28 20:06:43 +02:00
Michael Niedermayer
017884bdc3 avcodec/motionpixels: Mark 2 functions as always_inline
Fixes: Timeout (30sec -> 25sec)
Fixes: 17050/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOTIONPIXELS_fuzzer-5719149803732992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:36:12 +02:00
Michael Niedermayer
8335ba8ae9 avcodec/ituh263dec: Make the condition for the studio slice start code match between ff_h263_resync() and ff_mpeg4_decode_studio_slice_header()
If they mismatch an infinite loop can occur
Fixes: Timeout (infinite loop)
Fixes: 17043/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5695051748868096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:35:27 +02:00
Michael Niedermayer
fbb314b6f2 avcodec/ralf: Fix integer overflow in decode_channel()
Fixes: signed integer overflow: -1094995519 * 64 cannot be represented in type 'int'
Fixes: 17030/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5640695838146560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:35:27 +02:00
Michael Niedermayer
e75e7fe160 vcodec/vc1: compute rangex/y only for P/B frames
Fixes: left shift of 1073741824 by 1 places cannot be represented in type 'int'
Fixes: 16976/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-4847262047404032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:34:53 +02:00
Michael Niedermayer
ced9a1cd0a avcodec/vc1_pred: Fix invalid shifts in scaleforopp()
Fixes: left shift of negative value -2
Fixes: 16964/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5757853565976576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:34:53 +02:00
Michael Niedermayer
c722a69253 avcodec/vc1_block: Fix invalid shift with rangeredfrm
Fixes: left shift of negative value -7
Fixes: 16959/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-5200360825683968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:34:52 +02:00
Michael Niedermayer
181e138da7 avcodec/vc1: Check for excessive resolution
Fixes: overflow in aspect ratio calculation
Fixes: signed integer overflow: 393215 * 14594 cannot be represented in type 'int'
Fixes: 15728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5661588893204480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:34:24 +02:00
Michael Niedermayer
7f7af9e294 avcodec/vc1: check REFDIST
"9.1.1.43 P Reference Distance (REFDIST)"
"The value of REFDIST shall be less than, or equal to, 16."

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:33:20 +02:00
Michael Niedermayer
cf41da2ad2 avcodec/apedec: Allocate decoded_buffer after successful ff_get_buffer()
We need to reset samples in this case to avoid being stuck with incorrect
samples value.

Fixes: OOM
Fixes: Timeout
Fixes: 16627/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5638059583864832
Fixes: 17089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5672188463546368

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 18:25:20 +02:00
Michael Niedermayer
1e95a3e8a7 avcodec/apedec: Fix several integer overflows in predictor_update_filter() and do_apply_filter()
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: signed integer overflow: -14527961 - 2147483425 cannot be represented in type 'int'
Fixes: 16380/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5645957131141120
Fixes: 16968/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5716169901735936
Fixes: 17074/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5198710497083392

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 17:49:00 +02:00
Michael Niedermayer
f63cd1963e avcodec/hevc_cabac: Tighten the limit on k in ff_hevc_cu_qp_delta_abs()
Values larger would fail subsequent tests.

Fixes: signed integer overflow: 5 + 2147483646 cannot be represented in type 'int'
Fixes: 16966/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5695709549953024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 17:48:04 +02:00
Andreas Rheinhardt
4294dc3589 avfilter/vf_xbr: Fix left shift of negative number
Affected every usage of vf_xbr, e.g. the FATE-tests filter-2xbr,
filter-3xbr, filter-4xbr.

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-09-28 17:24:32 +02:00
Andreas Rheinhardt
fa21194326 avfilter/vf_hqx: Fix undefined left shifts of negative numbers
Affected every usage of this filter; in particular, it affected the
FATE-tests filter-2xbr, filter-3xbr and filter-4xbr.

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-09-28 17:24:32 +02:00
Andreas Rheinhardt
5cf593adcd avcodec/jpeg2000dwt: Fix undefined shifts of negative numbers
Affected the vsynth*-jpeg2000 and the vsynth*-jpeg2000-97 FATE tests
(where * ranges over { 1, 2, 3, _lena }) as well as ticket #7983.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 17:24:32 +02:00
Andreas Rheinhardt
324487b596 avcodec/ituh263dec: Fix undefined left shift of negative number
Fixes ticket #8160.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 17:24:32 +02:00
Andreas Rheinhardt
b7f156e8cb avcodec/dnxhdenc: Fix undefined left shifts of negative numbers
Affected 61 FATE-tests: 60 vsynth tests and lavf-mxf_opatom.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 17:24:32 +02:00
Andreas Rheinhardt
e2646e23be swscale/utils: Fix invalid left shifts of negative numbers
Affected the FATE-tests vsynth_lena-dv-411, vsynth1-dv-411,
vsynth2-dv-411 and hevc-paramchange-yuv420p.yuv420p10.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 17:24:32 +02:00
Andreas Rheinhardt
f7bc0386d9 avcodec/ffv1enc: Fix out-of-bounds-array access
libavcodec/ffv1enc.c accessed an array of uint8_t [32] via array[0][j]
in order to loop over all the uint8_t in this array of arrays. Of course
this implied an out-of-bounds access for array[0] and UBSan complained
about this. So replace this with nested loops; furthermore, factor this
out into a function of its own to easily break out of the nested loops.

This affected the FATE-tests vsynth1-ffv1, vsynth1-ffv1-v3-yuv420p,
vsynth1-ffv1-v3-yuv422p10, vsynth1-ffv1-v3-yuv444p16,
vsynth1-ffv1-v3-bgr0, vsynth1-ffv1-ffv1-v3-rgb48 as well as the
corresponding vsynth2-*, vsynth3-* and the vsynth_lena-* tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 17:24:32 +02:00