• Jindřich Makovička's avatar
    h264: avoid stuck buffer pointer in decode_nal_units · 1a8c6917
    Jindřich Makovička authored
    When decode_nal_units() previously encountered a NAL_END_SEQUENCE,
    and there are some junk bytes left in the input buffer, but no start codes,
    buf_index gets stuck 3 bytes before the end of the buffer.
    
    This can trigger an infinite loop in the caller code, eg. in
    try_decode_trame(), as avcodec_decode_video() then keeps returning zeroes,
    with 3 bytes of the input packet still available.
    
    With this change, the remaining bytes are skipped so the whole packet gets
    consumed.
    
    CC:libav-stable@libav.org
    Signed-off-by: 's avatarJindřich Makovička <makovick@gmail.com>
    Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
    1a8c6917
h264.c 159 KB