FFmpeg git repo
Go to file
Andreas Rheinhardt cfce16449c avformat/mpegenc: Ensure packet queue stays valid
The MPEG-PS muxer uses a custom queue of custom packets. To keep track
of it, it has a pointer (named predecode_packet) to the head of the
queue and a pointer to where the next packet is to be added (it points
to the next-pointer of the last element of the queue); furthermore,
there is also a pointer that points into the queue (called premux_packet).

The exact behaviour was as follows: If premux_packet was NULL when a
packet is received, it is taken to mean that the old queue is empty and
a new queue is started. premux_packet will point to the head of said
queue and the next_packet-pointer points to its next pointer. If
predecode_packet is NULL, it will also made to point to the newly
allocated element.

But if premux_packet is NULL and predecode_packet is not, then there
will be two queues with head elements premux_packet and
predecode_packet. Yet only elements reachable from predecode_packet are
ever freed, so the premux_packet queue leaks.
Worse yet, when the predecode_packet queue will be eventually exhausted,
predecode_packet will be made to point into the other queue and when
predecode_packet will be freed, the next pointer of the preceding
element of the queue will still point to the element just freed. This
element might very well be still reachable from premux_packet which
leads to use-after-frees lateron. This happened in the tickets mentioned
below.

Fix this by never creating two queues in the first place by checking for
predecode_packet to know whether the queue is empty. If premux_packet is
NULL, then it is set to the newly allocated element of the queue.

Fixes tickets #6887, #8188 and #8266.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-19 07:45:48 +01:00
compat All: update names in copyright headers 2021-01-20 01:02:56 -06:00
doc avfilter: add vif filter 2021-02-16 15:00:50 +01:00
ffbuild ffbuild/common: Make deletion of templates possible 2021-02-07 09:45:04 +01:00
fftools ffmpeg: add -fpsmax to clamp output framerate 2021-02-05 22:54:18 +05:30
libavcodec lavc/aarch64: add HEVC sao_band NEON 2021-02-18 14:12:01 +01:00
libavdevice avdevice/avdevice: Deprecate AVDevice Capabilities API 2021-02-14 21:07:57 +01:00
libavfilter dnn_backend_openvino.c: allow out_frame as NULL for analytic case 2021-02-18 09:59:37 +08:00
libavformat avformat/mpegenc: Ensure packet queue stays valid 2021-02-19 07:45:48 +01:00
libavresample
libavutil avutil/video_enc_params: Check for truncation before creating buffer 2021-02-19 07:45:39 +01:00
libpostproc lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump 2021-01-01 14:14:57 +01:00
libswresample
libswscale swscale/x86/yuv2yuvX: use the movsxdifnidn helper macro 2021-02-18 18:47:43 -03:00
presets
tests checkasm/sw_scale: use av_free() instead of free() 2021-02-17 20:57:33 -03:00
tools tools/target_dec_fuzzer: Adjust threshold for wavpack 2021-02-16 19:02:24 +01:00
.gitattributes
.gitignore
.mailmap
.travis.yml
CONTRIBUTING.md
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
Changelog avcodec: add initial exr image encoder 2021-02-18 13:00:40 +01:00
INSTALL.md
LICENSE.md
MAINTAINERS MAINTAINERS: update names 2021-01-20 01:04:26 -06:00
Makefile
README.md
RELEASE
configure avcodec: add initial exr image encoder 2021-02-18 13:00:40 +01:00

README.md

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.