Browse code

init_get_bits8: check byte_size against being positive

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ac73d3a12a33c5e4e6357d5f8824e19801663eb5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/01/15 00:22:41
Showing 1 changed files
... ...
@@ -406,7 +406,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
406 406
 static inline int init_get_bits8(GetBitContext *s, const uint8_t *buffer,
407 407
                                  int byte_size)
408 408
 {
409
-    if (byte_size > INT_MAX / 8)
409
+    if (byte_size > INT_MAX / 8 || byte_size < 0)
410 410
         return AVERROR_INVALIDDATA;
411 411
     return init_get_bits(s, buffer, byte_size * 8);
412 412
 }