Browse Source

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.0
Michael Niedermayer 7 years ago
parent
commit
e529fe7633
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavcodec/get_bits.h

+ 2
- 1
libavcodec/get_bits.h View File

@@ -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"

@@ -428,7 +429,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;


Loading…
Cancel
Save