From: Andreas Rheinhardt <ffmpegagent-at-gmail.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/get_bits: Remove GetBitContext.buffer_end Date: Fri, 04 Jul 2025 13:44:57 +0000 Message-ID: <012886e0925a718478551e04c6c59c7fb9d35eb9.1751636697.git.ffmpegagent@gmail.com> (raw) In-Reply-To: <pull.106.ffstaging.FFmpeg.1751636697.ffmpegagent@gmail.com> From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> It is unused. Furthermore, this automatically fixes the issue that init_get_bits() failure would lead to NULL + 0 (when setting buffer_end) which is UB before C23. This happened in the fic-avi and fic-avi-skip_cursor FATE-tests. This saved 7296B of .text here. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/get_bits.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index c64540cf95..80a77f0ae3 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -107,7 +107,7 @@ typedef BitstreamContext GetBitContext; #else // CACHED_BITSTREAM_READER typedef struct GetBitContext { - const uint8_t *buffer, *buffer_end; + const uint8_t *buffer; int index; int size_in_bits; int size_in_bits_plus8; @@ -512,7 +512,6 @@ static inline unsigned int show_bits_long(GetBitContext *s, int n) static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size) { - int buffer_size; int ret = 0; if (bit_size >= INT_MAX - FFMAX(7, AV_INPUT_BUFFER_PADDING_SIZE*8) || bit_size < 0 || !buffer) { @@ -521,12 +520,9 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ret = AVERROR_INVALIDDATA; } - buffer_size = (bit_size + 7) >> 3; - s->buffer = buffer; s->size_in_bits = bit_size; s->size_in_bits_plus8 = bit_size + 8; - s->buffer_end = buffer + buffer_size; s->index = 0; return ret; -- ffmpeg-codebot _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2025-07-04 13:45 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-07-04 13:44 [FFmpeg-devel] [PATCH 0/4] Get bits buffer end ffmpegagent 2025-07-04 13:44 ` [FFmpeg-devel] [PATCH 1/4] avcodec/bytestream: Add const where appropriate Andreas Rheinhardt 2025-07-04 13:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec/vvc/dec: Don't use GetBit-API when byte-aligned Andreas Rheinhardt 2025-07-04 13:44 ` [FFmpeg-devel] [PATCH 3/4] avcodec/get_bits: Add get_bits_bytesize() Andreas Rheinhardt 2025-07-04 13:44 ` Andreas Rheinhardt [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=012886e0925a718478551e04c6c59c7fb9d35eb9.1751636697.git.ffmpegagent@gmail.com \ --to=ffmpegagent-at-gmail.com@ffmpeg.org \ --cc=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git