diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-03-24 01:38:53 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-08 19:45:45 +0200 |
commit | e054e9fb20bfb3b077095c47e21e91d5f2067509 (patch) | |
tree | ced1dbac64236826f1b62c79360b402c295de0a1 | |
parent | 0288fa9319d5f3f7aa65c37d26ec7f90bfcdae02 (diff) | |
download | ffmpeg-e054e9fb20bfb3b077095c47e21e91d5f2067509.tar.gz |
avcodec/get_bits: Make sure the input bitstream with padding can be addressed
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e529fe7633762cb26a665fb6dee3be29b15285cc)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/get_bits.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 63ebe6ebfd..ed2f45c2c8 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -32,6 +32,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/log.h" #include "libavutil/avassert.h" +#include "avcodec.h" #include "mathops.h" #include "vlc.h" @@ -413,7 +414,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 || !buffer) { + if (bit_size >= INT_MAX - FFMAX(7, AV_INPUT_BUFFER_PADDING_SIZE*8) || bit_size < 0 || !buffer) { bit_size = 0; buffer = NULL; ret = AVERROR_INVALIDDATA; |