Commit Graph

106524 Commits

Author SHA1 Message Date
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
Paul B Mahol
fce0127642 avformat/pcmdec: add support to set channel layout
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2022-03-18 18:59:03 -03:00
James Almer
327efa6633 avutil/opt: add missing case for AV_OPT_TYPE_CHLAYOUT in av_opt_free()
Fixes potential memleaks for existing options of this type.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-18 18:59:03 -03:00
Michael Niedermayer
710e51677a avformat/matroskadec: Check pre_ns
Fixes: division by 0
Fixes: 44615/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6681108677263360

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
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
Paul B Mahol
b6af56c034 avfilter/af_afftdn: do not profile noise if number of sampled blocks is 0 2022-03-18 11:24:44 +01:00
Paul B Mahol
28447a4290 avfilter/af_afftdn: refactor set_noise_profile() 2022-03-18 11:24:44 +01:00
Paul B Mahol
ef8283fe1c avfilter/af_afftdn: remove unused defines 2022-03-18 11:24:44 +01:00
Paul B Mahol
7dc570ea13 fate: add tpad filter tests 2022-03-18 10:25:13 +01:00
James Almer
c606736836 gitignore: add config_components.h
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-17 18:35:41 -03:00
James Almer
b06eba6b7c Makefile: check config_components.h when comparing timestamps in component list files
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-17 18:35:41 -03:00
James Almer
3feabcd5ef Makefile: delete config_components.h on distclean
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-17 18:35:41 -03:00
Michael Niedermayer
cb9f17cd28 tools/target_dec_fuzzer: Adjust threshold for TQI
Fixes: Timeout
Fixes: 44455/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATQI_fuzzer-6069950551293952

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:24 +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
a13471fd04 tools/target_dec_fuzzer: Adjust threshold for DSICINVIDEO
Fixes: Timeout
Fixes: 44829/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSICINVIDEO_fuzzer-6190334340628480

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
Michael Niedermayer
bd3a03db9a avformat/matroskadec: Use rounded down duration in get_cue_desc() check
Floating point is evil, it would be better if duration was not a double

Fixes: Infinite loop
Fixes: 45123/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6725052291219456

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
0af06344cd avformat/boadec: fix check for invalid channel count
Regression since 8269fbcb7a.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-17 16:52:08 -03: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
c5628ae347 fate: add a setts bsf test
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-17 13:04:44 -03:00
Andreas Rheinhardt
814f806e06 avformat/imfdec: Convert to the new channel layout API
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-17 15:05:20 +01:00
Paul B Mahol
242c07982a doc/filters: add some afftdn examples 2022-03-17 11:02:07 +01:00
Paul B Mahol
44fb2463a3 doc/filters: mention sample_noise/sn options too
Also simplify commands section.
2022-03-17 11:02:07 +01:00
Paul B Mahol
1636f9f599 avfilter/af_afftdn: expose floor offset factor option 2022-03-17 11:02:07 +01:00
Martin Storsjö
bea841a743 Fix libversion.sh for split version headers, to unbreak shared library builds
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-17 11:11:17 +02: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
Paul B Mahol
ccb81acc3d avfilter/af_afftdn: rewrite noise floor tracking 2022-03-16 22:28:14 +01:00
Paul B Mahol
77d20a0f74 avfilter/af_afftdn: remove excessive operations 2022-03-16 22:28:14 +01:00
Marton Balint
ffff5bb740 avformat/mxfenc: do not write index tables with the same InstanceUID
Only index tables repeating previous index tables should use the same
InstaceUID. Use the index start position when generating the InstanceUID to fix
this.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-16 21:37:53 +01:00
Marton Balint
4afe4a542e avformat/mxfenc: allow more bits for variable part in uuid generation
Also make sure we do not change the product UID.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-16 21:37:53 +01:00
Paul B Mahol
2bcfe78ddf fate: add epx tests 2022-03-16 21:03:37 +01:00
Paul B Mahol
b63c9c7f97 fate: add chromashift tests 2022-03-16 21:03:36 +01:00
Marton Balint
ea887ef876 avfilter/vf_zscale: realign output buffer if needed
Output buffer alignment might be different to ZIMG_ALIGNMENT or it may not be
aligned at all if a downstream filter (e.g. vf_pad) intentionally misaligns it.

Or maybe we should unconditionally always allocate output with
av_frame_get_buffer() instead of ff_get_video_buffer()?

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-16 20:20:56 +01:00
Marton Balint
d5722d578e avfilter/vf_zscale: properly check return value of slice threads
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-16 20:20:56 +01:00
Marton Balint
c0351ee5c5 avfilter/vf_zscale: fix number of threads
Make sure it is between [1, MAX_THERADS] and also take into account the outlink
size in order not to request zero height output from zscale.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-16 20:20:56 +01:00
James Almer
11c4f4b455 ffmpeg: remove usage of internal deprecation macro
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-16 13:00:42 -03:00
James Almer
8ddf1795b9 avutil/attributes: add support for clang in AV_NOWARN_DEPRECATED
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-16 12:29:37 -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ö
288313a8b2 libavfilter: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00