diff options
author | Luca Barbato | 2013-01-20 05:10:32 +0100 |
---|---|---|
committer | Luca Barbato | 2013-01-20 13:37:56 +0100 |
commit | 4603ec85ed620e585fc6e2e072c99858ed421855 (patch) | |
tree | fd9a361560694a916e678b04e0e9e9c622bf85fa | |
parent | 0e02b381b4850bbc5b8e1ce6e17447968a2ae8b5 (diff) |
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.
-rw-r--r-- | libavcodec/get_bits.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 12770a29a0..ffa065600b 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -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; |