aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-07-04 14:31:13 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-07-11 15:13:21 +0200
commitba2c9acedb13e32c5622cb5d49657b34940088bc (patch)
tree681986e69b2fb4b37ec51cbe5ea93145b3cd15d4
parent367cf961ea1c0454479f0a1c8446d69904fc3e36 (diff)
downloadffmpeg-ba2c9acedb13e32c5622cb5d49657b34940088bc.tar.gz
avcodec/get_bits: Remove GetBitContext.buffer_end
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>
-rw-r--r--libavcodec/get_bits.h6
1 files changed, 1 insertions, 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;