[FFmpeg-devel] [PATCH 0/4] Get bits buffer end

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Jul 7 14:16:46 EEST 2025


ffmpegagent:
> This patchset eliminates GetBitContext.buffer_end (which is mostly unused).
> It therefore automatically fixes the UB that happens upon init_get_bits()
> failure (when using pre-C23).
> 
> Andreas Rheinhardt (4):
>   avcodec/bytestream: Add const where appropriate
>   avcodec/vvc/dec: Don't use GetBit-API when byte-aligned
>   avcodec/get_bits: Add get_bits_bytesize()
>   avcodec/get_bits: Remove GetBitContext.buffer_end
> 
>  libavcodec/bitstream.h          |  2 ++
>  libavcodec/bitstream_template.h |  8 ++++++++
>  libavcodec/bytestream.h         | 16 ++++++++--------
>  libavcodec/get_bits.h           | 21 ++++++++++++++++-----
>  libavcodec/h263dec.c            |  7 ++++---
>  libavcodec/h264_ps.c            |  4 ++--
>  libavcodec/hevc/hevcdec.c       |  2 +-
>  libavcodec/hevc/ps.c            |  6 +++---
>  libavcodec/mpeg12dec.c          |  5 +++--
>  libavcodec/vvc/dec.c            | 29 ++++++++++++++++-------------
>  10 files changed, 63 insertions(+), 37 deletions(-)
> 
> 
> base-commit: 0fe9f25e76163613505f77a8036dc62524070f0a
> Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-106%2Fmkver%2FGetBits_buffer_end-v1
> Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-106/mkver/GetBits_buffer_end-v1
> Pull-Request: https://github.com/ffstaging/FFmpeg/pull/106

Will apply this patchset tonight unless there are objections.

- Andreas



More information about the ffmpeg-devel mailing list