• Andreas Rheinhardt's avatar
    avcodec/cbs: Fix potential overflow · cda3e8ca
    Andreas Rheinhardt authored
    The number of bits in a PutBitContext must fit into an int, yet nothing
    guaranteed the size argument cbs_write_unit_data() uses in init_put_bits()
    to be in the range 0..INT_MAX / 8. This has been changed.
    
    Furthermore, the check 8 * data_size > data_bit_start that there is
    data beyond the initial padding when writing mpeg2 or H.264/5 slices
    could also overflow, so divide it by 8 to get an equivalent check
    without this problem.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    cda3e8ca
cbs.c 21.4 KB