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

107330 Commits

Author SHA1 Message Date
Michael Niedermayer
8f6432cd77 avcodec/flashsv: Check inflate() for failure
Fixes: CID1047223

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-07 21:52:52 +02:00
Michael Niedermayer
7796d740bd avcodec/smacker: fix indention after previous commit
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-07 21:52:52 +02:00
Michael Niedermayer
08e82e5b57 avcodec/smacker: Optimize constant 16bit audio output
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-07 21:52:52 +02:00
Michael Niedermayer
5c2fa59f32 tools/target_dec_fuzzer: Adjust threshold for smacker audio
Fixes: Timeout
Fixes: 47043/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-4824799337119744

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-07 21:52:52 +02:00
Marton Balint
b54f3e32fa avformat/img2enc: use unmatched filename for an invalid or missing sequence pattern
Also warn the user that for single images -update should be used, for sequences
a proper pattern should be specified.

Fixes ticket #9748.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-07-07 20:23:06 +02:00
Marton Balint
3f2de562c3 avformat/img2enc: fix first image check
Start image number was hardcoded to 1 for the first image check.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-07-07 20:23:06 +02:00
Paul B Mahol
6ed9eaf664 avfilter: add remap opencl filter 2022-07-07 17:52:32 +02:00
Marton Balint
03d81a044a avformat/mov: disallow a zero sample size in trun atoms
In order to not generate 0 sized packets or create a huge index table
needlessly.

Fixes: Timeout
Fixes: 43717/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5206008287330304
Fixes: 45738/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6142535657979904

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-07-06 23:37:29 +02:00
Marton Balint
7acc124121 Revert "avformat/demux: Make read_frame_internal() return AVERREOR(EAGAIN) on stuck empty input parser"
Hides the underlying real problem with a demuxer returning 0 sized packets.

This reverts commit 02699490c1.
2022-07-06 23:37:29 +02:00
Marton Balint
dbc3b5a902 Revert "avformat/demux: Count EAGAIN as 100 bytes in relation to read limit in avformat_find_stream_info()"
Modifying avformat_find_stream_info() behaviour based on the number of EAGAINs
it encounters is a hack which usually only hides the real issue if such thing
happen.

This reverts commit b0cac7082d.
2022-07-06 23:37:29 +02:00
Andreas Rheinhardt
aca09ed7d4 avutil/mem: Handle fast allocations near UINT_MAX properly
av_fast_realloc and av_fast_mallocz? store the size of
the objects they allocate in an unsigned. Yet they overallocate
and currently they can allocate more than UINT_MAX bytes
in case a user has requested a size of about UINT_MAX * 16 / 17
or more if SIZE_MAX > UINT_MAX (and if the user increased
max_alloc_size via av_max_alloc). In this case it is impossible
to store the true size of the buffer via the unsigned*;
future requests are likely to use the (re)allocation codepath
even if the buffer is actually large enough because of
the incorrect size.

Fix this by ensuring that the actually allocated size
always fits into an unsigned. (This entails erroring out
in case the user requested more than UINT_MAX.)

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-06 22:53:15 +02:00
Paul B Mahol
42518d8dd0 avcodec/exrenc: add av_cold to some functions 2022-07-06 19:41:44 +02:00
Timo Rothenpieler
85bc6b5abf avcodec/nvenc: add support for additional (10 bit) RGB pixel formats 2022-07-05 18:27:37 +02:00
Lynne
f9dd8fcf9b
)hwcontext: add a stub implementation for Vulkan functions 2022-07-05 15:20:08 +02:00
Martijn van Beurden
c8d839df73 avformat/mov: prevent potential use of uninitialized value 2022-07-05 14:11:23 +02:00
Martijn van Beurden
056a9fac5b avformat/cafdec: Implement FLAC-in-CAF parsing
The afconvert utility shipped with MacOS supports muxing of FLAC
in CAF, see afconvert help output on a recent Mac here:
https://hydrogenaud.io/index.php?topic=122509.0 A file created
with afconvert free of copyright (licensed CC0) can be found here:
http://www.audiograaf.nl/misc_stuff/afconvert-FLAC-in-CAF.caf
2022-07-05 14:11:20 +02:00
Vignesh Venkatasubramanian
aa8905a1b1 avfilter/xstack: Add support for fixed size grid
Add a short hand parameter for making a fixed size grid. The existing
xstack layout parameter syntax gets tedious if all one wants is a
matrix like grid of the input streams. Add a grid option to the xstack
filter that simplifies this use case by simply specifying the number of
rows and columns instead of specific x/y co-ordinate for each stream.

Also updating the filter documentation to explain the new option.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2022-07-04 19:49:31 +02:00
James Almer
0afdc95767 Revert "avutil/channel_layout: av_channel_layout_describe_bprint: Check for buffer end"
The doxy for av_channel_layout_describe() states that the user should look
at the return value to check if the string was truncated. Returning an error
code in this scenario goes against this and is an API break.

A proper fix for the timeout was applied to the Matroska demuxer in 94901a9518.

This reverts commit 8154cb7c2f.
2022-07-04 14:04:54 -03:00
James Almer
94901a9518 avformat/matroskadec: fix setting channel layout using the Channels element
If the stream's channel layout is first set into a native layout using codec
private parameters, this code here could potentially result in an invalid
native layout where popcnt(ch_layout.u.mask) != ch_layout.nb_channels being
propagated.

Fixes: Timeout printing a billion channels
Fixes: 48099/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-6754782204788736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-07-04 14:00:25 -03:00
Anton Khirnov
c9a2506de9 get_bits: move check_marker() to mpegvideodec.h
It is only used by mpegvideo-based decoders - specifically mpeg12, intelh263,
ituh263, mpeg4video.
2022-07-04 18:16:11 +02:00
Andreas Rheinhardt
8cfb44cd2e avcodec/mscc: Don't modify input packet
This packet may not be writable, hence we must not write to it.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-04 15:04:08 +02:00
Andreas Rheinhardt
930e560da3 avcodec/decoders: Use const uint8_t* to access input packet data
These packets need not be writable, so we must not modify them.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-04 15:04:01 +02:00
Andreas Rheinhardt
88f9b1fc45 avcodec/dcadec: Treat the input packet's data as const
A decoder's input packet need not be writable, so we must not modify
the data.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-04 15:03:53 +02:00
Andreas Rheinhardt
1fc5d327e4 avformat/(mpeg|mpegts|mxf|sup)enc: Use const uint8_t* to access pkt data
The packets muxers receive are not guaranteed to be writable,
so they must not be modified. Ergo only access the packet's data
via a const uint8_t*.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-04 14:56:43 +02:00
Gyan Doshi
dba7376d59 doc/ffmpeg: correct description of -shortest
-shortest stops 'recording' when the shortest output stream ends. The
native or even seek-adjusted duration of the source input stream isn't
considered.
2022-07-04 14:43:48 +05:30
Zhao Zhili
066368e837 avcodec/libdavs2: workaround memory leak
davs2_decoder_close doesn't free those on the fly frames which
don't get output yet. It's a design bug, but easy to workaround.

Before the patch:
Direct leak of 1198606 byte(s) in 2 object(s) allocated from:
    #0 0x563af5e1e5f0 in malloc (ffmpeg+0x6675f0)
    #1 0x563af9765ef3 in davs2_malloc davs2/source/common/common.h:1240
    #2 0x563af9765ef3 in davs2_alloc_picture davs2/source/common/header.cc:815

Indirect leak of 3595818 byte(s) in 6 object(s) allocated from:
    #0 0x563af5e1e5f0 in malloc (ffmpeg+0x6675f0)
    #1 0x563af9765ef3 in davs2_malloc davs2/source/common/common.h:1240
    #2 0x563af9765ef3 in davs2_alloc_picture davs2/source/common/header.cc:815

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-07-04 11:30:08 +08:00
Michael Niedermayer
9fec43a92d avcodec/alsdec: No channels cannot be accessed
Fixes: out of array access
Fixes: 48145/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5054524173189120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-03 19:36:26 +02:00
Michael Niedermayer
cd847f86d3 avcodec/qdrw: adjust max colors to array size
Fixes: out of array access
Fixes: 48429/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDRAW_fuzzer-4608329791438848

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>
2022-07-03 19:36:26 +02:00
Paul B Mahol
1b8647cfdc fate: add PFM encoder tests 2022-07-03 15:16:31 +02:00
Paul B Mahol
d70a443977 avcodec/pnmenc: support both endian variants for PFM 2022-07-03 15:16:31 +02:00
Paul B Mahol
ff1450e449 avcodec: add PHM decoder and encoder 2022-07-03 15:16:31 +02:00
Andreas Rheinhardt
33fe3b73c2 avcodec/tests/snowenc: Remove unused-but-set variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:49:31 +02:00
Andreas Rheinhardt
563c2ed272 avcodec/qoidec: Remove unused-but-set variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:41:23 +02:00
Andreas Rheinhardt
a88e8341cc avcodec/j2kenc: Remove unused-but-set variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:41:23 +02:00
Andreas Rheinhardt
8f99a72878 avcodec/imc: Remove unused-but-set variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:41:23 +02:00
Andreas Rheinhardt
bdaff63723 avcodec/hevc_ps: Remove unused-but-set variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:41:23 +02:00
Andreas Rheinhardt
624d0cf428 avfilter/vf_atadenoise: Remove unused-but-set variables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:41:23 +02:00
Andreas Rheinhardt
309ead7067 avformat/mlpdec: Remove unused-but-set variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:41:23 +02:00
Andreas Rheinhardt
204a72d7c4 avformat/bintext: Remove set-but-unused variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:41:23 +02:00
Paul B Mahol
ae90897bc9 fate: add EXR encoder tests 2022-07-03 10:30:05 +02:00
Michael Niedermayer
8709f4c10a avcodec/alacdsp: Make intermediates unsigned
Fixes: signed integer overflow: -14914387 + -2147418648 cannot be represented in type 'int'
Fixes: 46464/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-474307197311385

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-02 21:07:04 +02:00
Michael Niedermayer
8154cb7c2f avutil/channel_layout: av_channel_layout_describe_bprint: Check for buffer end
Fixes: Timeout printing a billion channels
Fixes: 48099/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-6754782204788736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-02 19:22:36 +02:00
Michael Niedermayer
c6f1e48b86 avformat/aiffdec: cleanup size handling for extreem cases
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-02 19:22:36 +02:00
Andreas Rheinhardt
55c605f72c avcodec/cbs_h2645: Remove unnecessary (h264|hevc)_sei.h inclusions
They are unnecessary since the SEI enum has been moved
to sei.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-02 08:58:20 +02:00
Andreas Rheinhardt
804bf898da avcodec/pthread_slice: Don't reinitialise initialised mutex
It results in undefined behaviour. Instead initialize the mutexes
and condition variables once during init (and check these
initializations).

Also combine the corresponding mutex and condition variable
into one structure so that one can allocate their array
jointly.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-01 15:35:11 +02:00
Wujian(Chin)
26e7d7b14e avcodec/v4l2_m2m: Check if the file descriptor is valid before closing
Fixes ticket #9507.

Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: wujian_nanjing <wujian2@huawei.com>
2022-07-01 09:59:48 +08:00
Andreas Rheinhardt
bf13a177d2 avcodec/libx264: Avoid duplicating strings
Also removes some unchecked allocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-01 00:40:02 +02:00
Andreas Rheinhardt
e9f2eb198b Makefile: Prompt for reconfigure on lavc/hwaccels.h modification
Adding a new AVHWAccel also adds a new CONFIG variable for it
and said config variables are typically used to calculate the
size of stack arrays. In such a context, an undefined CONFIG
variable does not evaluate to zero; instead it leads to
a compilation failure. Therefore treat this file like the other
files containing lists of configurable components and prompt
for reconfiguration if it is modified.

(E.g. a44fba0b5b led to compilation
failures for me.)

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-01 00:34:38 +02:00
Andreas Rheinhardt
e4be88704f avformat/movenc: Fix invalid check
Regression since c9de096851.
Fixes Coverity ID 1506839.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-30 22:19:54 +02:00
Jan Ekström
5eb8da6a81 avformat/movenc: limit ISOBMFF AC-3 mapping to bsids <=8
This leaves out RealAudio DolbyNet, which utilizes bsids 9 and 10,

It is not clear whether the interpreted bit rate value (divided by
2 or 4 depending on the variant), or the original bit rate value
should be utilized to receive the bit_rate_code index.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2022-06-30 16:14:05 +03:00