1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-03 14:32:16 +02:00

init_get_bits8: check byte_size against being positive

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-01-14 16:22:41 +01:00
parent c29c7c1470
commit ac73d3a12a

View File

@ -406,7 +406,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
static inline int init_get_bits8(GetBitContext *s, const uint8_t *buffer, static inline int init_get_bits8(GetBitContext *s, const uint8_t *buffer,
int byte_size) int byte_size)
{ {
if (byte_size > INT_MAX / 8) if (byte_size > INT_MAX / 8 || byte_size < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
return init_get_bits(s, buffer, byte_size * 8); return init_get_bits(s, buffer, byte_size * 8);
} }