Commit Graph

110657 Commits

Author SHA1 Message Date
Michael Niedermayer 19b66b89da
avcodec/tak: Check remaining bits in ff_tak_decode_frame_header()
Fixes: out of array access
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-6682195323650048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:26 +02:00
Michael Niedermayer 2632e90493
avcodec/sonic: Fix two undefined integer overflows
Fixes: signed integer overflow: 2147483372 - -148624 cannot be represented in type 'int'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5477177805373440
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-6681622236233728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:26 +02:00
Michael Niedermayer 34056a94ea
avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 16 allocated
Fixes: out of array access
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5124452659888128
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6362836707442688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:25 +02:00
Michael Niedermayer fd7352660b
avcodec/flacdec: Fix signed integre overflow
Fixes: signed integer overflow: 3011809745540902265 + 6323452730883571725 cannot be represented in type 'long'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6687553022722048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:25 +02:00
Michael Niedermayer 885ff3b879
avcodec/exr: Cleanup befor return
Fixes: leaks
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6703454090559488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:25 +02:00
Michael Niedermayer d31d4f3228
avcodec/pngdec: Do not pass AVFrame into global header decode
The global header should not contain a frame, and decoding it
would result in leaks

Fixes: memleak
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-6603443149340672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:24 +02:00
Michael Niedermayer 7117b380a7
avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:24 +02:00
Michael Niedermayer 6b1f68ccb0
avformat/hls: fail on probing non hls/m3u8 file extensions
Its unexpected that a .avi or other "standard" file turns into a playlist.
The goal of this patch is to avoid this unexpected behavior and possible
privacy or security differences.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:24 +02:00
Michael Niedermayer 5cc378cc46
avcodec/pdvdec: Check previous frame before using it
Fixes: load of null pointer of type 'uint8_t' (aka 'unsigned char')
Fixes: 58256/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PDV_fuzzer-4776436325285888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:23 +02:00
James Almer ed3691338b doc/examples/transcode_aac: use av_samples_alloc_array_and_samples to allocate the input samples buffer and pointers
Fixes -Wuse-after-free warnings and simplifies code.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-05 15:28:28 -03:00
James Almer 09b2ca93b4 avcodec/libdav1d: support parsing multiple ITU-T T.35 entries in a picture
This requires the newest libdav1d release.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-05 14:26:52 -03:00
Paul B Mahol 24f16b798e avfilter/af_join: set output frame duration 2023-05-05 17:20:14 +02:00
Paul B Mahol 67ca64c24b avfilter/af_adelay: fix frame pts and set frame duration 2023-05-05 17:20:14 +02:00
Paul B Mahol 217bb59f2e avfilter/af_amerge: set output frame duration 2023-05-05 17:20:13 +02:00
Paul B Mahol 6f1c82fd5b avfilter/af_biquads: reduce double type usage 2023-05-05 17:20:13 +02:00
Rémi Denis-Courmont 2919027936 MAINTAINERS: add vanitous self to maintain RISC-V
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-05 11:54:34 -03:00
Anton Khirnov 60ecf44b03 lavf/av1dec: stop setting codec context framerate
Demuxers are not supposed to do this.
2023-05-05 14:49:40 +02:00
Anton Khirnov e43be84c0f lavf/av1dec: mark as notimestamps 2023-05-05 14:49:40 +02:00
Anton Khirnov 2850584876 lavf/rawdec: stop setting codec context framerate
Demuxers are not supposed to do this.
2023-05-05 14:49:40 +02:00
Anton Khirnov e38e9f3d54 lavf/demux: use avg_frame_rate for packet durations for notimestamps formats
avg_frame_rate, if set, should be more reliable than stream timebase in
this case.
2023-05-05 14:49:40 +02:00
Anton Khirnov a59b4ac713 lavc/tak: do not store invalid values in stream info
When tak_get_nb_samples() fails, it will currently write
AVERROR_INVALIDDATA as TAKStreamInfo.frame_samples. The parser will then
use this negative value as a frame duration, which leads to various
breakage.

Avoid this by returning the error code from tak_parse_streaminfo()
directly; never store negative values in the parsed header.
2023-05-05 10:36:08 +02:00
Anton Khirnov ecdf1ac267 lavc/tak: make ff_tak_parse_streaminfo static
It is not used outside of tak.c
2023-05-05 10:35:08 +02:00
James Almer 6febb2a5ff avfilter/vf_coreimage: add missing semicolon
Fixes compilation after af8db9106c.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 22:38:47 -03:00
James Almer 0fc9c1f682 avutil/version: bump minor after recent changes
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 19:20:06 -03:00
James Almer 3e06f6f040 avutil/frame: deprecate key_frame
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 19:20:03 -03:00
James Almer c7a8681860 fftools: use the new AVFrame keyframe flag
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 19:19:18 -03:00
James Almer af8db9106c avfilter: use the new AVFrame key_frame flag in all filters
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 19:19:13 -03:00
James Almer dc7bd7c5a5 avcodec: use the new AVFrame key_frame flag in all decoders and encoders
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:48:22 -03:00
James Almer cc11191fda avutil/frame: add a keyframe flag to AVFrame
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:16:47 -03:00
James Almer 599abc0f3a avutil/frame: deprecate interlaced_frame and top_field_first
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:15:00 -03:00
James Almer 3675dd0e0c fftools: use the new AVFrame interlace flags
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:15:00 -03:00
James Almer 36827ea783 avfilter: use the new AVFrame interlace flags in all filters
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:14:11 -03:00
James Almer 2f561ba953 avcodec: use the new AVFrame interlace flags in all decoders and encoders
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:14:02 -03:00
James Almer 2df4e054d4 avutil/frame: add new interlaced and top_field_first flags
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 17:40:24 -03:00
Zhao Zhili 4006c71d19 avcodec/options_table: reorder nokey after nointra
So the values are in ascending order.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:13:07 +08:00
Zhao Zhili 0d40711f59 avcodec/hevcdec: remove unused variables from hls_slice_data
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:10:23 +08:00
Zhao Zhili 36a56d3cc8 avcodec/avcodec: fix UB NULL+0
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:10:11 +08:00
Niklas Haas ad417eb5fa doc/filters/libplacebo: fix outdated/wrong note
This has not been the case since c0b93c4f8+48c385fb4c.
2023-05-03 23:40:20 +02:00
Niklas Haas b80e43bf07 avfilter/vf_libplacebo: add flexible crop exprs
Motivated by a desire to use vf_libplacebo as a GPU-accelerated
cropping/padding/zooming filter. This commit adds support for setting
the `input/target.crop` fields as dynamic expressions.

Re-use the same generic variables available to other scale and crop type
filters, and also add some more that we can afford as a result of being
able to set these properties dynamically.

It's worth pointing out that `out_t/ot` is currently redundant with
`in_t/t` since it will always contain the same PTS values, but I plan on
changing this in the near future.

I decided to also expose `crop_w/crop_h` and `pos_w/pos_h` as variables
in the expression parser itself, since this enables the fairly common
use case of determining dimensions first and then placing the image
appropriately, such as is done in the default behavior (which centers
the cropped/placed region by default).
2023-05-03 23:40:20 +02:00
Niklas Haas 4b11a07550 avfilter/vf_libplacebo: add fillcolor option
In some circumstances, libplacebo will clear the background as a result
of cropping/padding. Currently, this uses the hard-coded default fill
color of black. This option makes this behavior configurable.
2023-05-03 23:40:20 +02:00
Paul B Mahol d94c6df975 avfilter/af_afreqshift: cache nb_coeffs value 2023-05-03 20:13:26 +02:00
Rémi Denis-Courmont 0e580806d8 riscv/intmath: use builtins for counting ones
As with the earlier bswap change, all versions of GCC and Clang that
support RISC-V support the popcount built-ins, so we can just use them
instead of inline assembler.
2023-05-02 22:08:25 +02:00
Rémi Denis-Courmont 7dcb5e1ab0 riscv/bswap: use compiler builtins
av_bswapXX() are used in context that expect exact size types, notably
variable arguments to av_log(). On Linux RV64, uint_fast32_t is an
unsigned long, so the current inline assembler does not work properly.

Since GCC and Clang gained their byte-swap built-ins before they
supported RISC-V, we can simply defer to them. As an added bonus, the
compiler can do instruction scheduling, which it couldn't with the Zbb
inline assembler.
2023-05-02 22:08:21 +02:00
Anton Khirnov 129c7bf53f fftools/ffmpeg: always use the same path for setting InputStream.[next_]dts
Currently those are set in different ways depending on whether the
stream is decoded or not, using some values from the decoder if it is.
This is wrong, because there may be arbitrary amount of delay between
input packets and output frames (depending e.g. on the thread count when
frame threading is used).

Always use the path that was previously used only for streamcopy. This
should not cause any issues, because these values are now used only for
streamcopy and discontinuity handling.

This change will allow to decouple discontinuity processing from
decoding and move it to ffmpeg_demux. It also makes the code simpler.

Changes output in fate-cover-art-aiff-id3v2-remux and
fate-cover-art-mp3-id3v2-remux, where attached pictures are now written
in the correct order. This happens because InputStream.dts is no longer
reset to AV_NOPTS_VALUE after decoding, so streamcopy actually sees
valid dts values.
2023-05-02 10:59:24 +02:00
Anton Khirnov 3190bed148 fftools/ffmpeg: constify packets passed to decode*()
They are not modified by these functions.
2023-05-02 10:59:24 +02:00
Anton Khirnov 302aecd06a fftools/ffmpeg: drop InputStream.[next_]pts
They are no longer used for anything.
2023-05-02 10:59:24 +02:00
Anton Khirnov ae95cd85dc fftools/ffmpeg_filter: stop using InputStream.pts for filter EOF ts
Use InputStream.last_frame_pts/duration instead, which is more accurate.
2023-05-02 10:59:24 +02:00
Anton Khirnov ef69f6a9d2 fftools/ffmpeg: stop using InputStream.pts for generating video timestamps
This was added in 380db56928 as a
temporary crutch that is not needed anymore. The only case where this
code can be triggered is the very first frame, for which InputStream.pts
is always equal to 0.
2023-05-02 10:59:24 +02:00
Anton Khirnov d85c6aba0c fftools/ffmpeg: rework audio-decode timestamp handling
Stop using InputStream.dts for generating missing timestamps for decoded
frames, because it contains pre-decoding timestamps and there may be
arbitrary amount of delay between input packets and output frames (e.g.
dependent on the thread count when frame threading is used). It is also
in AV_TIME_BASE (i.e. microseconds), which may introduce unnecessary
rounding issues.

New code maintains a timebase that is the inverse of the LCM of all the
samplerates seen so far, and thus can accurately represent every audio
sample. This timebase is used to generate missing timestamps after
decoding.

Changes the result of the following FATE tests
* pcm_dvd-16-5.1-96000
* lavf-smjpeg
* adpcm-ima-smjpeg
In all of these the timestamps now better correspond to actual frame
durations.
2023-05-02 10:59:24 +02:00
Anton Khirnov 6bbea932ca fftools/ffmpeg: set AVFrame.time_base for decoded frames
Makes it easier to keep track of the timebase the frames are in.
2023-05-02 10:59:24 +02:00