summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2018-03-24 01:38:53 +0100
committerMichael Niedermayer <[email protected]>2018-07-10 01:18:52 +0200
commit20e6a8dee8f82e38fc9c51ae7960fc01cf2fbea8 (patch)
tree2838cf663f3da0e5a71f288ae2348cfa6d7c71d6
parent17f626528a2913fa5b449cdad70f3796f2deacf2 (diff)
avcodec/get_bits: Make sure the input bitstream with padding can be addressed
Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit e529fe7633762cb26a665fb6dee3be29b15285cc) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavcodec/get_bits.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 72f8b5f29d..5a71795910 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"
/*
@@ -417,7 +418,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;