1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

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>
This commit is contained in:
Michael Niedermayer 2018-03-24 01:38:53 +01:00
parent e26ae6e6ce
commit 26fcff1eb4

View File

@ -32,6 +32,7 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/log.h" #include "libavutil/log.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "avcodec.h"
#include "mathops.h" #include "mathops.h"
#include "vlc.h" #include "vlc.h"
@ -428,7 +429,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
int buffer_size; int buffer_size;
int ret = 0; 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; bit_size = 0;
buffer = NULL; buffer = NULL;
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;