Commit Graph

101660 Commits

Author SHA1 Message Date
Derek Buitenhuis 85f397c828 avformat/mov: Fix extended atom size buffer length check
When extended atom size support was added to probing in
fec4a2d232, the buffer
size check was backwards, but probing continued to work
because there was no minimum size check yet, so despite
size being 1 on these atoms, and failing to read the 64-bit
size, the tag was still correctly read.

When 0b78016b2d introduced a
minimum size check, this exposed the bug, and broke probing
any files with extended atom sizes, such as entirely valid
large files that start whith mdat atoms.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-03-21 14:14:36 +00:00
Gyan Doshi 75fd3e1519 avformat/rtp_mpegts: typedef MuxChain struct 2021-03-21 15:50:40 +05:30
Gyan Doshi 36a5ae619a configure: select child muxers for rtp_mpegts 2021-03-21 15:50:23 +05:30
Carl Eugen Hoyos 288ca1c667 lavc/aomenc: Force default qmax of 0 if crf was set to 0.
Fixes lossless encoding without setting qmax to 0.
2021-03-21 09:46:23 +01:00
Carl Eugen Hoyos 9f8c81efc5 lavf/swfdec: Allow decoding Nellymoser in swf.
Such files exist in the wild, see ticket #9153.
2021-03-20 18:52:55 +01:00
Andreas Rheinhardt 8a73313412 avformat/pp_bnk: Fix memleaks when reading non-stereo tracks
Commit 6973df1122 added support
for music tracks by outputting its two containing tracks
together in one packet. But the actual data is not contiguous
in the file and therefore one can't simply use av_get_packet()
(which has been used before) for it. Therefore the packet was
now allocated via av_new_packet() and read via avio_read();
and this is also for non-music files.

This causes problems because one can now longer rely on things
done automatically by av_get_packet(): It automatically freed
the packet in case of errors; this lead to memleaks in several
FATE-tests covering this demuxer. Furthermore, in case the data
read is less than the data desired, the returned packet was not
zero-allocated (the packet's padding was uninitialized);
for music files the actual data could even be uninitialized.

The former problems are fixed by using av_get_packet() for
non-music files; the latter problem is handled by erroring out
unless both tracks could be fully read.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 08:21:30 +01:00
Andreas Rheinhardt 258a88dfe4 avformat/utils: Always leave parse_pkt in blank state, avoid resetting
Always leaving said packet in a blank state after having used it
allows to avoid having to reset it before one uses it; and it also
allows to use it in more places than just in parse_packet() here.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 04:23:05 +01:00
Andreas Rheinhardt 9faf3f8bb0 avcodec/parser: Don't return pointer to stack buffer
When flushing, the parser receives a dummy buffer with padding
that lives on the stack of av_parser_parse2(). Certain parsers
(e.g. Dolby E) only analyze the input, but don't repack it. When
flushing, such parsers return a pointer to the stack buffer and
a size of 0. And this is also what av_parser_parse2() returns.

Fix this by always resetting poutbuf in case poutbuf_size is zero.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 03:56:57 +01:00
Andreas Rheinhardt f21b47f38c avcodec/options: Reindent after previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 02:56:31 +01:00
Andreas Rheinhardt 784c3c0d85 avcodec/options: Remove always-true check
Added in dc51a72ba4, yet even back then
the check was always true as the AVCodecContext has already been memset
to zero before that.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 02:45:17 +01:00
Andreas Rheinhardt 77616c5fb4 avcodec/avcodec: Move decoder channel count check to ff_decode_preinit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 02:45:10 +01:00
Andreas Rheinhardt 746796ceb4 avcodec/avcodec: Sanitize options before using them
This is how it is supposed to happen, yet when using frame threading,
the codec's init function has been called before preinit. This can lead
to crashes when e.g. using unsupported lowres values for decoders
together with frame threading.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 01:55:41 +01:00
Andreas Rheinhardt e3156fa7c2 avcodec/avcodec: Perform sub_charenc/iconv checks before AVCodec.init()
Also move them to ff_decode_preinit().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 01:50:46 +01:00
Andreas Rheinhardt 02e43c00ed avcodec/avcodec: Check earlier for codec id/type mismatch
These fields can't be set via AVOptions, ergo one can check them before
having allocated anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-20 01:43:55 +01:00
Michael Niedermayer c361fa9e21 Bump minor versions after release branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-20 01:02:11 +01:00
Michael Niedermayer c67d2a2875 Bump Versions before release/4.4 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-20 01:01:12 +01:00
Michael Niedermayer 17cf309dfa doc/APIchanges: fill in missing fields
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-20 00:39:48 +01:00
Michael Niedermayer 33a1687bf6 avcodec/mpeg4videoenc: Check extradata malloc()
Fixes: Null pointer dereference
Fixes: any mpeg4 testcase which fails the malloc at that exact spot

Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-20 00:36:09 +01:00
Michael Niedermayer 92fde2585e avformat/mov: Check offset addition for overflow
Fixes: signed integer overflow: 9223372036854775807 + 536870912 cannot be represented in type 'long'
Fixes: 31678/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5614204619980800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-19 23:59:45 +01:00
Michael Niedermayer 462b8261aa avcodec/speedhq: Width < 8 is not supported
Fixes: out of array access
Fixes: 31733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEDHQ_fuzzer-4704307963363328
Fixes: 31736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEDHQ_fuzzer-6190960292790272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-19 23:59:45 +01:00
Jiangjie Gao 3e9284fccb avformat/rtsp: support buffer_size and pkt_size options for RTP
And forward it to the underlying UDP protocol.

Fixes ticket #7517.

Signed-off-by: Jiangjie Gao <gaojiangjie@live.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-19 23:13:26 +01:00
Dominic Mayers 626e0dd060 avfilter/vf_ocr: add white space to whitelist
Fixes #9151. The current version of libavfilter/vf_ocr.c does not have white
space in the default whitelist. But it is recommanded to include white
space. See https://github.com/tesseract-ocr/tesseract/issues/2923

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-19 23:00:04 +01:00
Zhao Zhili d86f44fecc avformat/libsrt: fix help message
SRTO_TLPKTDROP works for receiver and sender both.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-19 22:57:23 +01:00
Zhao Zhili 65bfb6af66 avformat/libsrt: fix setsockopt() typo
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-19 22:57:20 +01:00
Moritz Barsnick 94b63e8ae8 avformat/http,tls: honor http_proxy command line variable for HTTPS
Add the "http_proxy" option and its handling to the "tls" protocol,
pass the option from the "https" protocol.

The "https" protocol already defines the "http_proxy" command line
option, like the "http" protocol does. The "http" protocol properly
honors that command line option in addition to the environment
variable. The "https" protocol doesn't, because the proxy is
evaluated in the underlying "tls" protocol, which doesn't have this
option, and thus only handles the environment variable, which it
has access to.

Fixes #7223.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-19 22:43:02 +01:00
Hironori Bono 4892060f50 lavc/videotoolboxenc: Add support for HEVC with Alpha.
This change supports the "HEVC Video with Alpha" profile introduced in WWDC 2019
<https://developer.apple.com/videos/play/wwdc2019/506/>. (This change is a
partial fix for Ticket #7965.)

For example, the following command converts an animation PNG file to an HEVC
with Alpha video:
./ffmpeg -i fate-suite/apng/clock.png -c:v hevc_videotoolbox -allow_sw 1 -alpha_quality 0.75 -vtag hvc1 clock.mov

(This change uses the "HEVC Video with Alpha" profile only when the
'-alpha_quality' value is not 0 for backward compatibility.)

Signed-off-by: Hironori Bono <bouno@rouge.plala.or.jp>
2021-03-19 14:50:48 -04:00
Simone Karin Lehmann efece4442f videotoolboxenc: enable constant quality with -q:v on Apple Silicon Macs and use b-frames für HEVC and H264 and b-pyramid for HEVC.
Signed-off-by: Simone Karin Lehmann <simone@lisanet.de>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2021-03-19 14:50:48 -04:00
James Almer f47d7a3b42 avcodec: move core AVCodecContext functions from util.c to a new file
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-19 15:35:35 -03:00
James Almer 4057a060f6 avcodec: move AVCodecParameters related functions from util.c to a new file
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-19 15:33:54 -03:00
Zane van Iperen cbb8943a54
fate: add adpcm_ima_cunning stereo test case
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-19 23:38:33 +10:00
Zane van Iperen 6973df1122
avformat/pp_bnk: treat music files as stereo
These files are technically a series of planar mono tracks.
If the "music" flag is set, merge the packets from the two
mono tracks, essentially replicating:

  [0🅰️0][0🅰️1]join=inputs=2:channel_layout=stereo[a]

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-19 23:38:33 +10:00
Zane van Iperen d294c33231
avcodec/adpcm_ima_cunning: reindent
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-19 23:38:33 +10:00
Zane van Iperen 684745230f
avcodec/adpcm_ima_cunning: support stereo
Changes the sample format to S16P, but was only ever mono so it
affects nothing.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-19 23:38:25 +10:00
Gyan Doshi c5341d415c doc/filters: remove option band in delogo
Deprecated option removed in 74fe697f96 but I forgot to remove
the docs entry.
2021-03-19 17:21:03 +05:30
Gyan Doshi 3a79ab8317 doc/ffmpeg: document parameters set by -target 2021-03-19 17:00:17 +05:30
Andreas Rheinhardt e8c0bca6bd avutil/adler32: Switch av_adler32_update() to size_t on bump
av_adler32_update() is used by av_hash_update() which will be switched
to size_t at the next bump. So it also has to be made to use size_t.
This is also necessary for framecrcenc.c, because the size of side data
will become a size_t, too.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 04:19:53 +01:00
Andreas Rheinhardt a46d781905 avcodec/packet: Also change av_packet_pack/unpack_dictionary to size_t
These are auxiliary side-data functions, so they should have been
switched to size_t in d79e0fe65c,
but this has been forgotten.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 03:12:24 +01:00
Andreas Rheinhardt 04d001ca9b avcodec/avpacket: Improve overflow checks when packing dictionary
Also avoid reallocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 03:03:06 +01:00
Andreas Rheinhardt e318438f2f avformat: Make AVChapter.id an int64_t on next major bump
64 bits are needed in order to retain the uid values of Matroska
chapters; the type is kept signed because the semantics of NUT chapters
depend upon whether the id is > 0 or < 0.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 02:36:58 +01:00
Andreas Rheinhardt e1e6a5c8a5 avformat/matroskaenc: Check chapter ids for duplicates
Up until now, there has been no check that each chapter has a unique id;
there was only a check for whether a chapter id is zero (this happens
often when the chapters originated from a format that lacks the concept
of chapter id and simply counts from zero) which is invalid in Matroska.
In this case the chapter ids are offset by 1 to make them nonnegative.
Yet offsetting won't fix duplicate ids, therefore this is changed to
simply create new chapter uids when the input chapter uids don't conform
to the requirements of Matroska (in which case it can be presumed that
they did not originate from Matroska, so that we don't need to bother
to preserve them).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 02:31:49 +01:00
Andreas Rheinhardt 578539564a avcodec/libxvid: Remove set-but-unused variable
Set-but-unused since 2101b99777.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 02:25:16 +01:00
Andreas Rheinhardt 7f985c2174 avcodec/libxvid: Fix leak of AVPacket on error
Regression since 2101b99777.
Fixes Coverity issue #1473721.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 02:25:09 +01:00
Andreas Rheinhardt edcbb3e1b9 avformat/tests/fifo_muxer: Fix memleak on error, fix API violation
The test program for the FIFO muxer allocates a buffer without padding
and wraps it into a packet via av_packet_from_data(). This is an API
violation. Furthermore, said buffer leaks in case av_packet_from_data()
fails. Fix both of these issues by using av_new_packet() instead.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 02:25:02 +01:00
Andreas Rheinhardt aff1d373b1 avformat/tests/fifo_muxer: Fix leak of AVPacket on error
Also factor allocating and freeing the packet out.
Fixes Coverity issues #1473722 and #1473723; it is a regression
since 4b386b2059.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 02:24:53 +01:00
Andreas Rheinhardt ea1e15fdc4 avformat/mxfdec: Fix leak on error
It was introduced in d3d9b1fc8e2dfc8b4d66c9916ab7221062ff4660;
Fixes Coverity issue #733800.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 00:42:27 +01:00
Andreas Rheinhardt 9224b1f6b3 avformat/mxfdec: Don't use wrong type of pointer
If one of the two results of a ternary conditional is a pointer to void,
the type of the whole conditional operator is a pointer to void, even
when the other possible result is not a pointer to void. This loophole
in the type system has allowed mxf_read_local_tags to have a pointer of
type pointer to MXFMetadataSet that actually points to an MXFContext.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 00:41:16 +01:00
Andreas Rheinhardt 5edcdfc318 avcodec/pngdec: Fix memleak by postponing allocation
Fixes Coverity ticket #1322342.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 00:10:24 +01:00
Guo, Yejun da12d600ea lavfi/dnn_backend_openvino.c: fix mem leak for TaskItem upon error 2021-03-18 09:30:09 +08:00
Guo, Yejun df59ae8bb2 lavfi/dnn_backend_openvino.c: fix mem leak for RequestItem upon error 2021-03-18 09:30:09 +08:00
Guo, Yejun 41f4af16fc lavfi/dnn_backend_openvino.c: fix typo upon error 2021-03-18 09:30:09 +08:00