FFmpeg git repo
Go to file
Andreas Rheinhardt 195a25a7ab avfilter/formats: Leave lists' ownership unchanged upon merge failure
ff_merge_formats(), ff_merge_samplerates() and ff_merge_channel_layouts()
share common semantics: If merging succeeds, a non-NULL pointer is
returned and both input lists (of type AVFilterFormats resp.
AVFilterChannelLayouts) are to be treated as if they had been freed;
the owners of the input parameters (if any) become owners of the
returned list. If merging does not succeed, NULL is returned and both
input lists are supposed to be unchanged.

The problem is that the functions did not abide by these semantics:
In case of reallocation failure, it is possible for these functions
to return NULL after having already freed one of the two input list.
This happens because sometimes the refs-array of the destined output
gets reallocated twice to its final size and if the second of these
reallocations fails, the first of the two inputs has already been freed
and its refs updated to point to the destined output which in this case
will be freed immediately so that all of the already updated pointers
are now dangling. This leads to use-after-frees and memory corruptions
lateron (when these owners get cleaned up, the lists they own get
unreferenced). Should the input lists don't have owners at all, the
caller (namely can_merge_formats() in avfiltergraph.c) thinks that both
the input lists are unchanged and need to be freed, leading to a double
free.

The solution to this is simple: Don't reallocate twice; do it just once.
This also saves a reallocation.

This commit fixes the issue behind Coverity issue #1452636. It might
also make Coverity realize that the issue has been fixed.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-12 21:22:53 +02:00
compat compat/cuda/ptx2c: remove shell loop; fix BSD sed compat 2020-06-01 22:10:41 -05:00
doc doc/general: mark that CFHD have encoder now 2020-08-11 12:34:41 +02:00
ffbuild ffbuild: Refine MIPS handling 2020-07-23 16:30:02 +02:00
fftools fftools/ffmpeg: make specifying thread_queue_size turn on threaded input 2020-07-29 23:10:12 +02:00
libavcodec lavc/snowenc: Expose an option to set the rc_eq expression 2020-08-12 17:35:38 +02:00
libavdevice kmsgrab: Add more supported formats 2020-08-09 20:18:49 +01:00
libavfilter avfilter/formats: Leave lists' ownership unchanged upon merge failure 2020-08-12 21:22:53 +02:00
libavformat lavf/url: rewrite ff_make_absolute_url() using ff_url_decompose(). 2020-08-12 16:45:21 +02:00
libavresample
libavutil avutil/channel_layout: add 22.2 layout 2020-08-04 00:17:56 +03:00
libpostproc Bump minor versions after branching 4.3 2020-06-08 22:49:04 +02:00
libswresample swresample/rematrix: treat 22.2 as 5.1 (back) when mixing 2020-08-04 00:17:56 +03:00
libswscale swscale: do not drop half of bits from 16bit bayer formats 2020-08-08 12:03:42 +02:00
presets
tests lavc/aac_ac3_parser: fix potential overflow when averaging bitrate 2020-08-12 17:35:38 +02:00
tools dnn_backend_native_layer_mathunary: add round support 2020-08-12 10:30:46 +08:00
.gitattributes
.gitignore
.mailmap mailmap: add entry for myself 2020-07-13 11:24:04 +08:00
.travis.yml
Changelog avformat: add argo_asf muxer 2020-08-07 23:14:28 +10:00
configure kmsgrab: Use GetFB2 if available 2020-08-09 20:18:48 +01:00
CONTRIBUTING.md
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
INSTALL.md
LICENSE.md
MAINTAINERS MAINTAINERS: add myself and gpg fingerprint 2020-07-17 21:57:18 +02:00
Makefile Makefile: Delete more created files when running "make distclean". 2020-03-11 11:43:01 +01:00
README.md
RELEASE RELEASE: We are after the 4.3 branch point, update for that 2020-06-10 00:20:24 +02:00

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides a mean to alter decoded Audio and Video through chain of filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process and will be ignored.