This is more a style fix than a bugfix (CID1604392 Overflowed constant)
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -523,7 +523,7 @@ static int decode_byterun2(uint8_t *dst, int height, int line_size, · 522 unmodified lines | ||
| 523 | 523 | GetByteContext *gb) |
| 524 | 524 | { |
| 525 | 525 | GetByteContext cmds; |
| 526 | − unsigned count; | |
| 526 | + int count; | |
| 527 | 527 | int i, y_pos = 0, x_pos = 0; |
| 528 | 528 | |
| 529 | 529 | if (bytestream2_get_be32(gb) != MKBETAG('V', 'D', 'A', 'T')) |
| @@ -531,7 +531,7 @@ static int decode_byterun2(uint8_t *dst, int height, int line_size, · 1 unmodified line | ||
| 531 | 531 | |
| 532 | 532 | bytestream2_skip(gb, 4); |
| 533 | 533 | count = bytestream2_get_be16(gb) - 2; |
| 534 | − if (bytestream2_get_bytes_left(gb) < count) | |
| 534 | + if (count < 0 || bytestream2_get_bytes_left(gb) < count) | |
| 535 | 535 | return 0; |
| 536 | 536 | |
| 537 | 537 | bytestream2_init(&cmds, gb->buffer, count); |