Commit Graph

101871 Commits

Author SHA1 Message Date
Marton Balint
fb4da90fec avformat/url: add ff_make_absolulte_url2 to be able to test windows path cases
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-04-07 22:14:56 +02:00
Marton Balint
5dc5f289ce avformat/url: fix ff_make_absolute_url with Windows file paths
Ugly, but a lot less broken than it was.

Fixes ticket #9166.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-04-07 22:14:56 +02:00
James Almer
557953a397 avformat/utils: add helper functions to retrieve index entries from an AVStream
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-07 09:51:44 -03:00
Gyan Doshi
c06465a70b doc/muxers: fix alphabetical sorting of entries 2021-04-07 14:45:03 +05:30
Vittorio Giovara
9afde28093 mov: Skip computing SAR from invalid display matrix elements 2021-04-06 16:52:07 +02:00
Andreas Rheinhardt
3e16d1c8a6 avcodec/bsf: Simplify getting codec name
All codec ids on BSF whitelists have a codec descriptor, so one can just
use avcodec_get_name() without worrying about the case of what happens
when no codec descriptor is found.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-06 03:20:59 +02:00
Michael Niedermayer
0f6a3405e8 avformat/mov: check offset for overflow in mov_probe()
Fixes: Invalid read of size 4
Fixes: ASAN_Deadlysignal.zip

Found-by: Hardik Shah <hardik05@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-05 18:41:59 +02:00
Andreas Rheinhardt
9b6ffcf0fd avcodec/options: Remove always-true check
Every codec has a name.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-05 18:36:51 +02:00
Andreas Rheinhardt
416cc012f6 avutil/frame: Return 0 on success in av_frame_ref()
av_frame_copy() is allowed to return values >= 0 on success, whereas
the documentation of av_frame_ref() states that the return value is 0 on
success. Ergo the latter must not just return the former's return value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-05 18:36:51 +02:00
Andreas Rheinhardt
b3652d9745 avformat/dss: Return 0 on success
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-05 18:36:51 +02:00
Andreas Rheinhardt
48a594aba5 avformat/dss: Avoid using intermediate buffer
All one needs is one byte beyond the end of the normal data; and because
the packet is padded, one already has it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-05 18:34:52 +02:00
Andreas Rheinhardt
ef8c8b4163 avformat/dss: Set values known during read_header in read_header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-05 17:48:11 +02:00
Andreas Rheinhardt
5d06d26be3 avformat/mpegtsenc: Preserve disposition in the absence of language
Implements ticket #9113.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-05 04:04:00 +02:00
Andreas Rheinhardt
0617e578a3 avfilter/vf_find_rect: Use correct format specifier
Fixes the following GCC warning:
warning: format ‘%lld’ expects argument of type ‘long long int’,
but argument 4 has type ‘int64_t’ {aka ‘long int’} [-Wformat=]

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-04 12:02:45 +02:00
Martin Storsjö
b1b7cc698b atomics: Fix the win32 atomic_exchange function
This fixes building with MSVC after
a2a38b1606.

Remove the stray semicolon, and add casts for the input argument
(which is an intptr_t*) to the right type (PVOID volatile *).

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-04-04 11:06:08 +03:00
Gyan Doshi
18dcbb0d6c avfilter/find_rect: write score to metadata 2021-04-04 10:47:13 +05:30
Gyan Doshi
abdafca9ad avfilter/find_rect: add option to discard non-matching frames
Default is disabled.
2021-04-04 10:47:09 +05:30
Gyan Doshi
aff23c3474 avfilter/find_rect: improve logging
Log now indicates timestamps of frames where a match is made.
Loglevel is changed to INFO since the user specifically wants this info.
2021-04-04 10:46:57 +05:30
Andreas Rheinhardt
e93875b756 avcodec/wmavoice: Check operations that can fail
There might be segfaults on failure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-03 22:26:51 +02:00
Andreas Rheinhardt
a5b2f06b0c avcodec/mjpegdec: Fix leak in case ICC array allocations fail partially
If only one of the two arrays used for the ICC profile could be
successfully allocated, it might be overwritten and leak when
the next ICC entry is encountered. Fix this by using a common struct,
so that one has only one array to allocate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-03 22:26:51 +02:00
Michael Niedermayer
da8c86dd8b avcodec/cfhd: Keep track of which subbands have been read
This avoids use of uninitialized data
also several checks are inside the band reading code
so it is important that it is run at least once

Fixes: out of array accesses
Fixes: 28209/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5684714694377472
Fixes: 32124/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5425980681355264
Fixes: 30519/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4558757155700736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-03 19:27:21 +02:00
Michael Niedermayer
3b88c88fa1 avcodec/cfhd: Require valid setup before Lowpass coefficients, BandHeader and BandSecondPass
Previously the code skipped all security checks when these where encountered but prior data was incorrect.
Also replace an always true condition by an assert

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-03 19:27:21 +02:00
Michael Niedermayer
20473a93d2 avcodec/cfhd: Check transform_type consistently
Fixes: out of array accesses
Fixes: 29754/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6333598414274560
Fixes: 30519/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6298424511168512
Fixes: 30739/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5011292836462592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-03 19:27:21 +02:00
Andreas Rheinhardt
d5ddfec6c3 avcodec/mjpegdec: Check initializing Huffman tables
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-03 17:49:01 +02:00
Andreas Rheinhardt
3cc685b7bc avcodec/mjpegdec: Fix leak in case of invalid external Huffman tables
When using external Huffman tables fails during init, the decoder
reverts back to using the default Huffman tables; and when doing so,
the current VLC tables leak because init_default_huffman_tables()
doesn't free them before overwriting them.

Sample:
samples.ffmpeg.org/archive/all/avi+mjpeg+pcm_s16le++mjpeg-interlace.avi

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-03 17:48:40 +02:00
Andreas Rheinhardt
0ca09335aa avcodec/a64multienc: Don't use static buffers, fix potential races
render_charset() used static buffers that are always completely
initialized before every use, so that it is unnecessary for the
values in these arrays to be kept after leaving the function.
Given that this is not only unnecessary, but harmful due to the
possibility of data races if several instances of a64multi/a64multi5
run simultaneously these buffers have been replaced by ordinary buffers
on the stack (they are small enough for this).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-03 13:07:43 +02:00
Andreas Rheinhardt
5c0f6d53da avcodec/rawdec: Free bitstream_buf
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-03 11:54:12 +02:00
Gyan Doshi
090dc381a1 doc/ffmpeg: clarify what -hwaccels list indicates
Fixes #8204
2021-04-03 10:58:07 +05:30
Andreas Rheinhardt
af867e59d9 avformat/vividas: Fix crash when seeking without audio stream
The current code tries the access the codecpar of a nonexistent
audio stream when seeking. Stop that. Fixes ticket #9121.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 21:03:39 +02:00
Andreas Rheinhardt
a2a38b1606 avutil/cpu: Fix race condition in av_cpu_count()
av_cpu_count() intends to emit a debug message containing the number of
logical cores when called the first time. The check currently works with
a static volatile int; yet this does not help at all in case of
concurrent accesses by multiple threads. So replace this with an
atomic_int.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 19:12:43 +02:00
Andreas Rheinhardt
f38f791a23 avcodec/ass_split: Don't presume strlen to be >= 2
Fixes potential heap-buffer-overflow.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 19:07:59 +02:00
Andreas Rheinhardt
0062aca592 avcodec/binkaudio: Check return value of functions that can fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 19:01:13 +02:00
Andreas Rheinhardt
85aed2e390 avcodec/binkaudio: Fix memleak upon init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 18:56:13 +02:00
Andreas Rheinhardt
56bd071e54 avcodec/flacenc: Fix memleak upon init error
An AVMD5 struct would leak if an error happened after its allocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 18:55:27 +02:00
Andreas Rheinhardt
d789d72d30 avcodec/proresenc_anatoliy: Fix memleak upon init error
A buffer may leak in case of YUVA444P10 with dimensions that are not
both divisible by 16.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 18:45:05 +02:00
Andreas Rheinhardt
9bf2b32da0 avcodec/bsf: Fix segfault when freeing half-allocated BSF
When allocating a BSF fails, it could happen that the BSF's close
function has been called despite a failure to allocate the private data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 18:09:26 +02:00
Andreas Rheinhardt
8081a0b10f avcodec/av1_metadata_bsf: Check for the existence of units
Fixes a crash with ISOBMFF extradata containing no OBUs.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 18:05:02 +02:00
Andreas Rheinhardt
b917218c35 avcodec/h264_metadata_bsf: Don't add AUD to extradata
This is a regression since switching to the generic CBS BSF code.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 18:04:35 +02:00
Andreas Rheinhardt
b0cd60bd97 avcodec/tiff: Don't use separate temporary buffer for fax
Also don't unnecessarily copy the input data around if it needn't be
reversed; and remove a redundant memset -- av_fast_padded_malloc()
already does this for us.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 17:40:54 +02:00
Andreas Rheinhardt
f0042e573e avcodec/msmpeg4enc: Don't use code for static init that can fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 16:01:10 +02:00
Andreas Rheinhardt
afa511ad34 avformat/dss: Don't prematurely modify context variable
The DSS demuxer currently decrements a counter that should be positive
at the beginning of read_packet; should it become negative, it means
that the data to be read can't be read contiguosly, but has to be read
in two parts. In this case the counter is incremented again after the
first read if said read succeeded; if not, the counter stays negative.

This can lead to problems in further read_packet calls; in tickets #9020
and #9023 it led to segfaults if one tries to seek lateron if the seek
failed and generic seek tried to read from the beginning. But it could
also happen when av_new_packet() failed and the user attempted to read
again afterwards.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 15:36:32 +02:00
Andreas Rheinhardt
543e4a1942 avformat/utils: Check allocations for failure
There would be leaks in case of failure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 15:27:42 +02:00
Andreas Rheinhardt
18bb323da4 avcodec/ac3enc: Simplify AC-3 bit counting
When encoding E-AC-3, whether coupling is on or not determines whether
an additional frame based coupling exponent strategy element frmcplexpstr
(of size five bits) is present in the bitstream. So just add five to the
number of bits when counting them instead of adding 5*s->cpl_on (the
latter field is currently only 0 or 1, so it doesn't make a difference).

Furthermore, move some parts of the bit allocation that doesn't change
per-frame to count_frame_bits_fixed() (which is only run once during
init).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 12:19:07 +02:00
Andreas Rheinhardt
eca36784b8 avcodec/[e]ac3enc: Fix indentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 12:19:07 +02:00
Andreas Rheinhardt
5d4234b3ea avcodec/ac3enc: Avoid needlessly copying encoded packets around
AC-3 and EAC-3 are codecs whose packet sizes are known in advance,
so one can use the min_size parameter of ff_alloc_packet2() to
allocate exactly this amount. This avoids a memcpy later in
av_packet_make_refcounted() in encode_simple_internal().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 12:06:56 +02:00
Andreas Rheinhardt
968c158abd avcodec/ac3enc: Use actual size of buffer in init_put_bits()
Since the very beginning (since de6d9b6404)
the AC-3 encoder used AC3_MAX_CODED_FRAME_SIZE (namely 3840) for the
size of the output buffer (without any check at all).
This causes problems when encoding EAC-3 for which the maximum is too small,
smaller than the actual size of the buffer: One can run into asserts used
by the PutBits API. Ticket #8513 is about such a case and this commit
fixes it by using the real size of the buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-02 12:06:56 +02:00
Gyan Doshi
3d97a0061c doc/muxers: add entry for A64 muxer 2021-04-02 15:21:32 +05:30
Gyan Doshi
a3f695d54b doc/encoders: add entry for a64 encoders 2021-04-02 15:20:14 +05:30
Zane van Iperen
aa1cfe05a5
avcodec/adpcmenc: don't share a single AVClass between multiple AVCodecs.
Temporary fix until AVClass::child_class_next is gone.

Reviewed-By: James Almer <jamrial@gmail.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-04-02 09:00:32 +10:00
Alan Kelly
3ce8d09244 libswscale/x86/yuv2yuvX: Removes unrolling for mmx and mmxext
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-01 20:47:52 +02:00