get_bits: change the failure condition in init_get_bits
Too much code relies in having init_get_bits fed with a valid buffer and set its dimension to 0. Check for NULL buffer instead. (cherry picked from commit 4603ec85ed620e585fc6e2e072c99858ed421855) Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
8b24e17d09
commit
a89acaa0b0
@ -357,7 +357,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
|
|||||||
int buffer_size;
|
int buffer_size;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (bit_size > INT_MAX - 7 || bit_size <= 0) {
|
if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
|
||||||
buffer_size = bit_size = 0;
|
buffer_size = bit_size = 0;
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
ret = AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user