diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-01-20 05:10:32 +0100 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-01-25 01:01:25 +0100 |
commit | a89acaa0b0dbf463a4a60499421e770608a23903 (patch) | |
tree | d8b6b56e85213c2c307abb0b751592cd07e9cf7c | |
parent | 8b24e17d0920e070e0353dee6901fbaf8666f94f (diff) | |
download | ffmpeg-a89acaa0b0dbf463a4a60499421e770608a23903.tar.gz |
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>
-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 dc348c7713..db70937c14 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -357,7 +357,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; |