Commit Graph

102863 Commits

Author SHA1 Message Date
Andreas Rheinhardt 1500b7dfa5 avformat/av1dec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 21:40:13 +02:00
Andreas Rheinhardt ef7eaa4529 avformat/assdec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 21:35:49 +02:00
Andreas Rheinhardt 0de329e8e8 avformat/aqtitledec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 21:32:24 +02:00
Andreas Rheinhardt 58da6b18a3 avformat/ape: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 21:26:43 +02:00
Andreas Rheinhardt 609672a4a3 avformat/avidec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 21:23:13 +02:00
Andreas Rheinhardt 822be43849 avformat/aaxdec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 21:15:33 +02:00
Andreas Rheinhardt b09b166829 avformat/aadec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 20:57:43 +02:00
Andreas Rheinhardt f7fb09cb00 avformat/4xm: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 20:54:53 +02:00
Andreas Rheinhardt 0d81c0a10e avformat: Redo cleanup of demuxers upon read_header() failure
If reading the header fails, the demuxer's read_close() function (if
existing) is not called automatically; instead several demuxers call it
via "goto fail" in read_header().

This commit intends to change this by adding an internal flag for
demuxers that can be used to set on a per-AVInputFormat basis whether
read_close() should be called generically after an error during
read_header().

The flag controlling this behaviour needs to be added because it might
be unsafe to call read_close() generally (e.g. this might lead to
read_close() being called twice and this might e.g. lead to double-frees
if av_free() is used instead of av_freep(); or a size field has not
been reset after freeing the elements (see the mov demuxer for an
example of this)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 20:48:50 +02:00
Andreas Rheinhardt 0f6b34bfec avformat: Add internal flags for AV(In|Out)putFormat
Both AVInputFormat and AVOutputFormat currently lack an equivalent to
AVCodec's caps_internal. E.g. if reading a header fails, each demuxer
is currently required to clean up manually, which often means to just
call the demuxer's read_close function. This could (and will) be done
generically via an equivalent of FF_CODEC_CAP_INIT_CLEANUP.

Because of the unholy ABI-relationship between libavdevice and
libavformat adding such a flag is only possible when the ABI is open
(despite the flag not being part of the public API), such as now.
Therefore such a flag is also added to AVOutputFormat, despite there
being no immediate use for it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 20:22:22 +02:00
Marton Balint 758e2da289 avfilter/f_metadata: do not return the frame early if there is no metadata
The early return caused isses for the "add" mode (got fixed in
c95dfe5cce) and the "select" mode needs a similar
fix. It is probably better to fully remove the check, since all modes work
correctly with NULL metadata.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-07-06 21:58:19 +02:00
Michael Niedermayer 29c95765e8 tools/target_dec_fuzzer: move maximum variables into function
This fixes an issue when multiple cases are fuzzed in a single run and
the limits are adjusted by more than the iteration limit. In that case
the adjusted limit leaked back into the global limit causing the
fuzzer to become ineffective after several iterations, MSS2 was
affected by this for example.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-06 21:44:31 +02:00
Michael Niedermayer 343d950a4a avformat/matroskadec: Fix handling of huge default durations
Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself
Fixes: 33997/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6752039691485184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-06 21:44:31 +02:00
Kyle Schwarz a61d190972 libavformat/rtpdec_rfc4175: Check for zero pgroup before mod
Signed-off-by: Kyle Schwarz <zeranoe@gmail.com>
2021-07-06 16:37:59 +02:00
Gyan Doshi b7ba472f43 avfilter/fps: remove unconventional acronyms
In dd770883e9, support for expressions was added. Among the constants
added were labels of qnstc, qpal, sntsc & spal.

These were added in ba2a8cb40b to represent parameter permutations where
only the resolution is different. They don't have any usage currency and
don't represent any industry standards or convention in terms of framerate.
2021-07-06 11:43:31 +05:30
Limin Wang 493f9a5432 avfilter/dnn_filter_common: Use const where appropriate
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-07-06 10:47:57 +08:00
Andriy Gelman 6df4bcf1d0 avformat/rtsp: Include rtcp in port range check
Currently it is only checked that the rtp port does not exceed rtp_port_max.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-07-05 13:37:39 -04:00
Andriy Gelman d1f78067a6 avformat/rtsp: Reindent after previous commit
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-07-05 13:37:26 -04:00
Andriy Gelman 02387de90e avformat/rtsp: Set port_off to zero for low min/max port range
Fixes:
$ ffmpeg -min_port 32000 -max_port 32001 -i rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov -f null -
[1]    303871 floating point exception (core dumped)

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-07-05 13:36:22 -04:00
Andriy Gelman 78f21f4ec1 avcodec/mjpegdec: Try to continue decoding on zero quant matrix value
A zero value in the quantization matrix is invalid but in practice will
just set the transform coefficient to zero after inverse quantization.
Try to continue decoding if the AV_EF_EXPLODE flag is not set.

Fixes ticket #9287.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-07-05 13:00:50 -04:00
Andriy Gelman 8257d6dda6 avformat/rtsp: Fix timeout option
92c40ef882 added a listen_timeout option
for sdp. This allowed a user to set variable timeout which was
originally hard coded to 10 seconds.

The commit used the initial_timeout variable to store the value. But
this variable is shared with rtsp where it's used to infer a "listen"
mode. Thus, the timeout value could not be set in rtsp, and the default
value (initial_timeout = -1) would give 100ms timeout.

This was attempted to be fixed in c8101aabee,
which changed the meaning of initial_timeout = -1 to be an infinite
timeout. However, it did not address the issue that the timeout could
still not be set. Being able to set the timeout is useful because it
allows to automatically reconfigure from a udp to tcp connection in the
lower transport.

In this commit this is fixed by using the stimeout variable to
store the timeout value.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-07-05 12:49:55 -04:00
James Almer 041267b558 avcodec/setts_bsf: add a NOPTS constant
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-04 11:18:43 -03:00
James Almer b0b3fce3c3 avcodec/setts_bsf: actually store the current packet's timestamps to be usable by the next
Before this change, the PREV_OUTPTS and PREV_OUTDTS constants always evaluated
to AV_NOPTS_VALUE.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-04 11:16:01 -03:00
Shubhanshu Saxena f73943d514 lavfi/dnn_backend_openvino.c: Fix Memory Leak in execute_model_ov
In cases where the execution inside the function execute_model_ov fails,
push the RequestItem back to the request_queue before returning the error.
In case pushing back fails, release the allocated memory.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-07-04 18:56:17 +08:00
Gyan Doshi 301d275301 avcodec/bsf: switch to av_get_token to parse bsf list string
The recently added setts bsf makes use of the eval API whose
expressions can contain commas. The existing parsing in
av_bsf_list_parse_str() uses av_strtok to naively split
the string at commas, thus preventing the use of setts filter
with expressions containing commas.

av_get_token can work with escaped commas, allowing full use of setts.
2021-07-04 09:54:33 +05:30
Michael Niedermayer 70874e024a avcodec/lpc: check for zero err in normalization in compute_lpc_coefs()
Fixes: floating point division by 0
Fixes: Ticket8213

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-03 18:03:35 +02:00
Michael Niedermayer 6a6a765fa4 avcodec/j2kenc: Check for av_strtok() failure
Fixes: CID1466601 Dereference null return value

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-03 18:03:35 +02:00
Michael Niedermayer 9d40782088 avformat/ftp: Check for av_strtok() failure
Fixes: CID1396258 Dereference null return value

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-03 18:03:35 +02:00
Michael Niedermayer 0b3cdd7cc2 tools/cws2fws: Check read() for failure
Fixes: CID1452579 Argument cannot be negative

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-03 18:03:35 +02:00
Michael Niedermayer 532c65f751 tools/target_dec_fuzzer: Adjust threshold for theora
Fixes: Timeout
Fixes: 33916/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-4620863119949824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-03 18:03:35 +02:00
Anton Khirnov 37c0fe49b7 sws: move updating the palette higher up
It does not interact in any way with the code setting up the image
pointers/strides, so it should not be intermixed with it.
2021-07-03 16:13:40 +02:00
Anton Khirnov d6649d9a3b sws: move initializing dither_error higher up
It does not interact in any way with the code setting up the image
pointers/strides, so it should not be intermixed with it.
2021-07-03 16:13:10 +02:00
Anton Khirnov e188985598 sws: move the early return for zero-sized slices higher up
Place it right after the input parameter validation. There is no point
in performing any setup if the sws_scale() call won't do anything.
2021-07-03 16:09:43 +02:00
Anton Khirnov a91e6c927e sws: simplify setting sliceDir 2021-07-03 16:09:21 +02:00
Anton Khirnov ff753f41dd sws: merge handling frame start into a single block
Also, return an error code on failure rather than 0.
2021-07-03 16:09:07 +02:00
Anton Khirnov 1b11a324fe sws: make checking for the start of a new frame more explicit 2021-07-03 16:07:22 +02:00
Anton Khirnov 0fb014b7bb sws: reset sliceDir at the end of sws_scale()
Makes it more clear that resetting it does not interact with the scaling
code that it is currently intermixed with.
2021-07-03 16:05:39 +02:00
Anton Khirnov 1f80789bf7 sws: rename SwsContext.swscale to convert_unscaled
That function pointer is now used only for unscaled conversion.
2021-07-03 15:57:53 +02:00
Anton Khirnov fe490ec165 sws: separate the calls to scaled vs unscaled conversion
Call the scaler function directly rather than through a function
pointer. Drop the now-unused return value from ff_getSwsFunc() and
rename the function to reflect its new role.

This will be useful in the following commits, where it will become
important that the amount of output is different for scaled vs unscaled
case.
2021-07-03 15:57:13 +02:00
Anton Khirnov 0f8e0957d2 sws: do not reallocate scratch buffers for each slice 2021-07-03 15:56:16 +02:00
Anton Khirnov 2730639259 sws: group the parameters validity checks together
Also, fail with an error code rather than 0.
2021-07-03 15:31:18 +02:00
Anton Khirnov c05cab34a9 sws: initialize {src,dst}Stride2 consistently with {src,dst}2 2021-07-03 15:31:08 +02:00
Anton Khirnov d3d8e09640 sws: cosmetics
Reindent after previous commit, rewrap long lines.
2021-07-03 15:30:56 +02:00
Anton Khirnov f136493d03 sws: factor out cascaded scaling 2021-07-03 15:30:34 +02:00
Anton Khirnov a2254aedc9 sws: cosmetics
Reindent after previous commit, split long lines.
2021-07-03 15:30:20 +02:00
Anton Khirnov 44f12718bf sws: factor out gamma-correct scaling 2021-07-03 15:29:50 +02:00
Anton Khirnov e355af9be9 sws: return an error code on invalid parameters to sws_scale() 2021-07-03 15:29:35 +02:00
Anton Khirnov 21a4e48f88 sws: reindent after previous commit 2021-07-03 15:29:22 +02:00
Anton Khirnov 27acca1af0 sws: factor out updating the palette 2021-07-03 15:28:46 +02:00
Anton Khirnov f8c21ccbfc sws: remove unnecessary braces
There used to be more code inside them, but it was removed in
6de58b4903.
2021-07-03 15:28:36 +02:00