1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

46341 Commits

Author SHA1 Message Date
Andreas Rheinhardt
3d4634f1ff avcodec/zmbv: Use ff_inflate_init/end()
Returns better error messages in case of error and deduplicates
the inflateInit() code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt
dd8a55cb3e avcodec/zlib_wrapper: Add wrappers for zlib inflateInit, inflateEnd
It is not documented to be safe to call inflateEnd() on a z_stream
that has never been successfully been initialized by inflateInit(),
but just zeroed. It just happens to work and several codecs rely
on this (they have FF_CODEC_CAP_INIT_CLEANUP set and even call
inflateEnd() when inflateInit() failed or has never been called).
To avoid this, other codecs recorded whether their zstream has been
initialized successfully or not.

This commit adds wrappers for inflateInit() and inflateEnd() that
do what these other codecs do; furthermore, they also take care of
properly setting up the zstream before inflateInit() and emit
an error message in case of error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt
db57a5370b avcodec/pngenc: Avoid potentially truncating integers
So use 64bits for max_packet_size instead of size_t which might be
32 bits; this is consistent with ff_alloc_packet().
Also remove a redundant size check (ff_alloc_packet() already
checks for that).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Martin Storsjö
2d368392a5 Keep including the full version.h when headers are included externally
This avoids unnecessary churn and build breakage for users, by
making sure the whole version.h is included like it has been so far,
while keeping the benefit of not needing to rebuild most files in
the ffmpeg tree on minor/micro bumps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-19 00:01:57 +02:00
Michael Niedermayer
28008bf95e avcodec/sonic: Use unsigned for predictor_k to avoid undefined behavior
Fixes: signed integer overflow: -1094995529 * 24 cannot be represented in type 'int'
Fixes: 44436/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-4874459459223552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-18 19:56:50 +01:00
Michael Niedermayer
8701af40bc avcodec/ccaption_dec: Use ff_ass_add_rect2()
Fixes: Timeout
Fixes: 42258/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CCAPTION_fuzzer-5540144118104064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-18 19:56:50 +01:00
Michael Niedermayer
aed698efc3 avcodec/ass: Faster ff_ass_add_rect()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-18 19:56:50 +01:00
Zhao Zhili
6f210ebae2 avcodec/setts_bsf: fix memleak
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-18 12:31:38 -03:00
Michael Niedermayer
31916d3d9f avcodec/alsdec: Set channels from data after data is set
Fixes: out of array write
Fixes: 45624/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-6473487382872064
Fixes: 45626/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-4874997192065024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-18 12:31:32 +01:00
Michael Niedermayer
b59ea948cd avcodec/dfpwmdec: Check packet size more completely
Fixes: out of array access
Fixes: 45497/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DFPWM_fuzzer-5239786212818944.fuzz
Fixes: 45510/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DFPWM_fuzzer-4947856883056640

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-03-18 12:31:32 +01:00
Michael Niedermayer
e88b99afdf avcodec/libuavs3d: Check ff_set_dimensions() for failure
Untested, no testcase

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-17 22:27:24 +01:00
Michael Niedermayer
6530c240c8 avcodec/speexdec: Align some comments
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-17 22:27:23 +01:00
Michael Niedermayer
487679cc50 avcodec/speexdec: Use correct doxygen comments
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-17 22:27:23 +01:00
Michael Niedermayer
18bc612f2f avcodec/dfa: Optimize output reshuffle loop
18035 -> 4018 dezicycles (Tested with LOGOS.DFA, gcc 7, 3950X)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-17 22:27:23 +01:00
Michael Niedermayer
d1bf5b7d96 avcodec/mjpegbdec: Set buf_size
Fixes: Timeout
Fixes: 45170/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-5874820431085568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-17 22:27:23 +01:00
James Almer
85b7be53e1 avcodec/setts_bsf: don't repeatedly set start pts and dts
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-17 13:04:44 -03:00
James Almer
c834083861 avcodec/setts_bsf: fix setting output timebase
Set a valid max value for the option, and also check numerator before
assuming the value is useful.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-16 23:43:07 -03:00
Martin Storsjö
a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the
list of enabled components has changed, but not the other properties
of the build, set in config.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:49 +02:00
Martin Storsjö
f3a0e2ee2b doc: Add an entry to APIchanges about changes to version.h and version_major.h
Also bump the minor versions of all libraries, to signify the
API change of splitting the version.h headers and adding the
new version_major.h header.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:46 +02:00
Martin Storsjö
f2da2e1458 libavcodec: Split version.h
This avoids including version.h in all source files, avoiding
unnecessary rebuilds when the version number is bumped. Only
version_major.h is included by the main header, which defines
availability of e.g. FF_API_* macros, and which is bumped much
less often.

This isn't done for libavutil/version.h, because that header needs
to be included essentially everywhere due to LIBAVUTIL_VERSION_INT
being used wherever an AVClass is constructed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:04:35 +02:00
James Almer
3aeeee1597 avcodec/hevc_refs: don't use the frame's AVBufferRef sizes when initializing planes
Use the actual plane sizes instead.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 18:16:54 -03:00
Marton Balint
ef2b3efd51 avcodec/codec_par: do not copy AVChannelLayout struct directly
Later we use av_channel_layout_copy, but that uninits the struct
unintentionally freeing the possibly allocated u.map pointer.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-15 16:24:52 +01:00
James Almer
cdba98bb80 Bump minor versions after the channel layout changes
Forgotten in the respective commits adding new API.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 11:12:21 -03:00
James Almer
f0be7c1057 avcodec/audiotoolboxenc: add missing AVCodec.ch_layouts
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 10:57:08 -03:00
James Almer
739c96ba1a avcodec/dca_lbr: set nchannels
Fixes warnings about uninitialized values

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 10:37:54 -03:00
James Almer
a02663d997 avcodec/audiotoolboxenc: use the correct macros for standard channel layouts
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 10:27:12 -03:00
Martin Storsjö
6383862ae2 avcodec/audiotoolboxenc: Fix the use of FF_ARRAY_ELEMS
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-15 15:25:04 +02:00
James Almer
793c85bc4d avcodec/audiotoolboxenc: use the correct function name
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 10:18:53 -03:00
Anton Khirnov
e6358ec1ac opus: export mapping family 2 (Ambisonic) as Ambisonic layout
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:47 -03:00
James Almer
7d532f474d tests: convert to new channel layout-API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:47 -03:00
Anton Khirnov
5636972c7a lavc: drop temporary compat wrappers for channel layout API change
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:46 -03:00
Anton Khirnov
bfe86a761a ws-snd1: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
3c933af493 wma: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
03ba5cf321 wavpack: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
457e88fcaf vorbis: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
eb81c946c1 vmdaudio: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Vittorio Giovara
972586344a vima: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Vittorio Giovara
9386ca98b6 twinvq: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
1191ffd50a tta: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
0045c6dd5c truespeech: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
cf512325cb tak: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
James Almer
2b1fd08f3f speex: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
73cb6c87ac sonic: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
a9dfca7c59 smacker: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
James Almer
35789608ae siren: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:45 -03:00
Anton Khirnov
6114a1f71d sipr: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:44 -03:00
Anton Khirnov
fb722bab3e shorten: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:44 -03:00
Anton Khirnov
b7483d02c2 sbc: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:44 -03:00
Anton Khirnov
3caf14e0a4 s302m: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:44 -03:00
Anton Khirnov
1d4e6ce31c roqaudioenc: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:44 -03:00