Commit 4603ec85 authored by Luca Barbato's avatar Luca Barbato

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.
parent 0e02b381
......@@ -375,7 +375,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
int buffer_size;
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 = NULL;
ret = AVERROR_INVALIDDATA;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment