rnp icon indicating copy to clipboard operation
rnp copied to clipboard

Barely reproducible malloc_consolidate() failure.

Open ni4 opened this issue 1 year ago • 0 comments

Description

The following test case causes malloc_consolidate(): unaligned fastbin chunk detected in a single runner (Fedora 36 + Botan 3.1.1), which is not reproducible with enabled santizers or on local Docker container. Additionally, from comment on this issue https://stackoverflow.com/questions/3100193/segfaults-in-malloc-and-malloc-consolidate :

Interestingly my code was crashing on malloc_consolidate somewhere deep within the google test library... setting MALLOC_CHECK_ to any value 0, 1, or 2 seems to prevent the crash but no matter what setting I use it doesn't print any additional diagnostic information so I still have no clue what was causing the error.

TEST_F(rnp_tests, test_ffi_wrong_hex_length)
{
    rnp_ffi_t ffi = NULL;

    // setup FFI
    assert_rnp_success(rnp_ffi_create(&ffi, "GPG", "GPG"));
    // load our keyrings
    assert_true(load_keys_gpg(ffi, "data/keyrings/1/pubring.gpg"));

    // edge cases
    {
        rnp_key_handle_t key = NULL;
        assert_rnp_failure(rnp_locate_key(ffi, "keyid", "BC6709B15C23A4A", &key));
        assert_rnp_failure(rnp_locate_key(ffi, "keyid", "C6709B15C23A4A", &key));
    }

    rnp_ffi_destroy(ffi);
}

ni4 avatar Feb 15 '24 15:02 ni4