1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-18 03:19:31 +02:00
Commit Graph

113065 Commits

Author SHA1 Message Date
Paul B Mahol
cb26b85953 avcodec/svq1dec: fix runtime error: applying non-zero offset 4 to null pointer 2023-09-23 10:04:08 +02:00
Paul B Mahol
5d98259841 avcodec/pnmdec: fix decoding with AVFrame's negative linesize 2023-09-23 01:42:49 +02:00
Paul B Mahol
cdf0931fdb avcodec/pcx: fix decoding with AVFrame's negative linesize 2023-09-23 01:42:48 +02:00
Paul B Mahol
ee357d6991 avcodec/rasc: fix decoding with AVFrame's negative linesize 2023-09-23 01:14:12 +02:00
Michael Niedermayer
284d1a8a6a
avcodec/wavarc: Use unsigned for samples in 1dif, 2slp, 5elp
Fixes: signed integer overflow: 141394472 + 2038060365 cannot be represented in type 'int'
Fixes: 61787/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5882604925878272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-22 23:47:41 +02:00
Michael Niedermayer
b12444fe72
avcodec/xvididct: Fix integer overflow in idct_row()
Fixes: signed integer overflow: 1871429831 + 343006811 cannot be represented in type 'int'
Fixes: 61784/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AIC_fuzzer-5372151001120768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-22 23:47:41 +02:00
Michael Niedermayer
6580a7b2b2
avcodec/celp_math: avoid overflow in shift
by making gain unsigned we have 1 bit more available
alternatively we can clip twice as in the g729 reference

Fixes: left shift of 23404 by 17 places cannot be represented in type 'int'
Fixes: 61728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-6280412547383296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-22 23:47:40 +02:00
Michael Niedermayer
f1954ff8d1
avcodec/vvc_parser: Avoid undefined overflow in POC computation
The comments to the function say that it does not implement the spec and
instead follows VTM.
This patch is quite likely not the right solution and more intended to show
the issue to people knowing the specific part of VTM ...

Fixes: signed integer overflow: 2147483392 + 256 cannot be represented in type 'int'
Fixes: 60505/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6216675924770816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-22 23:47:40 +02:00
Michael Niedermayer
9ee87245c5
tools/target_dec_fuzzer: Adjust threshold for rtv1
Fixes: 60499/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RTV1_fuzzer-5020295866744832
Fixes: Timeout

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-22 23:47:40 +02:00
Michael Niedermayer
3aff8503a9
avformat/mov: Avoid cloning encryption info if its unchanged
Fixes: OOM
Fixes: 45834/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5419540462305280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-22 23:47:39 +02:00
Michael Niedermayer
120f74650d
avcodec/evc_ps: Check cpb_cnt_minus1 and propagate error
Fixes: out of array access
Fixes: 60949/clusterfuzz-testcase-minimized-ffmpeg_dem_EVC_fuzzer-5959738853294080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-22 23:47:39 +02:00
Paul B Mahol
87cf1be905 avcodec/lcldec: fix decoding with AVFrame's negative linesize 2023-09-22 23:38:00 +02:00
Paul B Mahol
445167d5fd avcodec/cdxl: fix decoding with AVFrame's negative linesize 2023-09-22 23:12:55 +02:00
Paul B Mahol
24f63cb2b7 avcodec/gifdec: rewrite functions that fill block/frame
Also fix AVFrame's negative linesize decoding.
2023-09-22 22:56:59 +02:00
Paul B Mahol
1242d172e2 avfilter: use ptrdiff_t instead of int for linesize
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2023-09-22 22:56:57 +02:00
Paul B Mahol
c192ebc806 avcodec/cdgraphics: fix decoding with AVFrame's negative linesize 2023-09-22 22:56:22 +02:00
Paul B Mahol
035d187c4d avformat/hca: add support for decryption 2023-09-22 08:52:18 +02:00
Fei Wang
63371cde9d lavc/av1: Add unit test for level handling
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:01 +08:00
Fei Wang
3be81e3b44 lavc/vaapi_encode: Add VAAPI AV1 encoder
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Acked-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
254c5a8134 lavc/vaapi_encode: Separate reference frame into previous/future list
To support more reference frames from different directions.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
11b81838ae lavc/vaapi_encode: Extract set output pkt property function
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
4a4400709c lavc/vaapi_encode: Init pic at the beginning of API
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
695477a1c7 avcodec/cbs_av1: Allow specifying obu size byte length
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Mark Thompson
abe16daea1 cbs: Make tracing more general
Turn tracing into callbacks for each syntax element, with default
callbacks to match current trace_headers behaviour for debug.  Move
the construction of bit strings into the trace callback, which
simplifies all of the read and write functions.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
6c3a5d625f avcodec/cbs_av1: Add tx mode enum values
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
James Almer
95b5c81729 avcodec/extract_extradata: use size_t as parameter type in val_in_array()
It only gets passed the return value of FF_ARRAY_ELEMS(), which is a size_t.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-21 22:04:22 -03:00
Paul B Mahol
365529178d avformat/cafdec: improve probing 2023-09-21 22:41:10 +02:00
Paul B Mahol
ea06317190 avcodec/osq: do not return immediately on fatal error 2023-09-21 20:32:41 +02:00
Damiano Galassi
33b2646d61 lavf/movenc: enable dvh1 FourCC
This is required to pass through Dolby Vision metadata to x265.
Profiles 5 and 8 require the "dvh1" fourCC:
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby-vision-streams-within-the-http-live-streaming-format-v2.0-13-november-2018.pdf#unique_10
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolbyvisioninmpegdashspecification_v2_0_public_20190107.pdf#unique_13
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf

See also https://github.com/HandBrake/HandBrake/pull/4838 for more
details.

Fixes: https://trac.ffmpeg.org/ticket/10257
2023-09-20 21:19:45 +01:00
Zhao Zhili
3951c1899e avfilter/vf_smartblur: pass old context to sws_getCachedContext
Otherwise it make no sense to use sws_getCachedContext.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-20 23:24:55 +08:00
Nuo Mi
9ef20920ab
avcodec/cbs_h266_syntax_template: Check num_output_layers_in_ols
from the specification:
For each OLS, there shall be at least one layer that is an output layer. In other words, for any value of i in the range of 0
to TotalNumOlss − 1, inclusive, the value of NumOutputLayersInOls[ i ] shall be greater than or equal to 1

Fixes: index 257 out of bounds for type 'uint8_t [257]'
Fixes: 61160/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-6709397181825024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-19 21:28:40 +02:00
James Almer
13d22dc454
avcodec/dcadec: Do not explode EAGAIN
Fixes: out of array access
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DCA_fuzzer-6041088751960064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-19 21:28:40 +02:00
Michael Niedermayer
42b20c93ae
avcodec/decode: EAGAIN is not fully supported in decode_simple_internal()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-19 20:24:46 +02:00
Andreas Rheinhardt
63eb630915 avcodec/libvpxdec: Remove redundant unreferencing of AVFrame
The AVFrame of a decoder with the ordinary decode callback
is generically unreferenced on error.

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-19 18:11:46 +02:00
James Almer
ac64800edd avcodec/extract_extradata: filter what Metadata OBUs are included in AV1 extradata
Only those that are relevant for the entire coded stream should be included.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-19 13:00:08 -03:00
James Almer
abc346de73 configure: rework parsing --cpu arguments to support all features unless blacklisted
Keeping an ever growing list of CPUs just to pass -march to the compiler and
enable fast_cmov is a waste of time. Every CPU we know has limitations is
already handled here, so just fallback to enabling everything when a passed in
argument is not one of those.

This will enable optimizations for CPU architectures released in the past 7 or
so years with supported GCC and clang compilers when used as argument in
configure, instead of silently ignoring them.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-19 12:47:38 -03:00
Paul B Mahol
fa20f5cd9e avcodec/vlc: add correct upper limit for recursive function 2023-09-18 20:11:48 +02:00
Zhao Zhili
ba9cd06c76 avutil/avutil: make AV_TIME_BASE_Q available in C++
ISO C++ forbids compound-literals. It's not available with MSVC.
This is a known issue from 10 years ago, and that's why there is a
av_get_time_base_q().

Since we have no plan to remove AV_TIME_BASE_Q, just make it
available in C++.

There are multiple choices:
1. Use C++11 syntax: AVRational{1, AV_TIME_BASE}

Users may still use C++98 to write new code. So no.

2. Use av_get_time_base_q().

It's for this purpose. But it's not compile time constants as
AV_TIME_BASE_Q in C.

So I choose av_make_q() as Anton's suggestion.

https://libav-devel.libav.narkive.com/ZQCWfTun/patch-0-2-fix-avutil-h-usage-from-c
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-19 00:52:21 +08:00
Zhao Zhili
1c61aa1a02 avcodec/jni: make global variables static
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-19 00:41:08 +08:00
Zhao Zhili
eb96dda5ed avdevice/android_camera: fix missing include for usleep
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-19 00:39:47 +08:00
Anton Khirnov
5d58a35f98 fftools/ffmpeg: deprecate the -top option
It is badly named (should have been -top_field_first, or at least -tff),
underdocumented and underspecified, and (most importantly) entirely
redundant with the setfield filter.
2023-09-18 17:16:06 +02:00
Anton Khirnov
43a0004b5c fftools/ffmpeg_enc: apply -top to individual encoded frames
Fixes #9339.
2023-09-18 17:15:53 +02:00
Anton Khirnov
74b643a51e fftools/ffmpeg_enc: refactor setting encoding field_order
Merge three blocks with slightly inconsistent checks into one, treating
encoder input as interlaced when either:
* at least one of ilme/ildct flags is set
* the first frame in the stream is marked as interlaced
* the user specified the -top option

Stop modifying the frame passed to enc_open().
2023-09-18 17:15:53 +02:00
Anton Khirnov
85e075587d lavf: deprecate AVFMT_FLAG_SHORTEST
It was added in cb114ed464 with the comment
"This will allow fixing several bugs with the -shortest option".

Since
* there is no explanation of what these bugs are
* libavformat is not the place to work around ffmpeg CLI bugs
* there is no indication that this feature is actually in use
deprecate it without replacement.
2023-09-18 17:10:59 +02:00
Leo Izen
9b454fdaef
avformat/libssh: avoid deprecated functions
Avoid using the deprecated functions ssh_try_publickey_from_file among
others in favor of symbols introduced in libssh 0.6.0 (Jan 2014) and
update configure to require this version.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-09-18 08:43:24 -04:00
Andreas Rheinhardt
da1d56776c avcodec/pthread_frame: Constify src pointees
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 12:36:03 +02:00
Andreas Rheinhardt
1046cfe347 avcodec/pthread_frame: Remove FF_API_SLICE_OFFSET
Since 432adca5fe no decoder
looks at the slice_count and slice_offset fields at all,
so there is no reason to synchronize them between the worker
and the user thread.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 12:35:54 +02:00
Andreas Rheinhardt
0e6fdebd0d avcodec/vp3: Simplify shuffling frames, fix crash on alloc error
When decoding non-keyframes, the decoding process expects
there to be two reference frames, the last one and the golden
one. The existence of the golden one is checked and in case
it is there, it is presumed that the last one exists as well.

This assumption is wrong in case of memory allocation failure,
namely in case the call to ff_thread_ref_frame() that sets
the last frame fails.

Fix this by actually performing a shuffle without creating
new references. This can't fail and has the advantage of
fewer implicit allocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:14 +02:00
Andreas Rheinhardt
3614f7e1cc avcodec/vp3: Fix undefined pointer arithmetic
When decoding a keyframe, last_frame and golden_frame are
not used at all and (at least when starting decoding)
are not set at all. But due to code sharing pointer arithmetic
on the NULL data-pointers of these frames has nevertheless
been performed. This is undefined behaviour and causes e.g.
"runtime error: applying non-zero offset 173440 to null pointer"
from UBSan in the vp31, vp4, theora-coeff-level64 and theora-offset
FATE-tests.

Fix this by reusing the current frame for unavailable frames.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:14 +02:00
Andreas Rheinhardt
f9b6e3e48d avcodec/pthread_frame: Only set PerThreadContext* when frame-threading
Otherwise the thread_ctx pointer might be NULL or point to
a SliceThreadContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:14 +02:00