History

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.

Andreas Rheinhardt committed 1 year ago

Commit ba2c9ac1 parent 367cf961 file · +1 −5Browse files

Unified · Split

libavcodec/get_bits.h+1−5
@@ -107,7 +107,7 @@ typedef BitstreamContext GetBitContext; · 106 unmodified lines
107107 #else // CACHED_BITSTREAM_READER
108108
109109 typedef struct GetBitContext {
110− const uint8_t *buffer, *buffer_end;
110+ const uint8_t *buffer;
111111 int index;
112112 int size_in_bits;
113113 int size_in_bits_plus8;
@@ -512,7 +512,6 @@ static inline unsigned int show_bits_long(GetBitContext *s, int n) · 398 unmodified lines
512512 static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
513513 int bit_size)
514514 {
515− int buffer_size;
516515 int ret = 0;
517516
518517 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, · 2 unmodified lines
521520 ret = AVERROR_INVALIDDATA;
522521 }
523522
524− buffer_size = (bit_size + 7) >> 3;
525−
526523 s->buffer = buffer;
527524 s->size_in_bits = bit_size;
528525 s->size_in_bits_plus8 = bit_size + 8;
529− s->buffer_end = buffer + buffer_size;
530526 s->index = 0;
531527
532528 return ret;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t