Skip to content
Snippets Groups Projects
Commit e529fe76 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

avcodec/get_bits: Make sure the input bitstream with padding can be addressed

parent 78f8036c
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -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, ...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment