Commit fee423bb authored by Todd Short's avatar Todd Short Committed by Andy Polyakov
Browse files

Fix the mem_sec "small arena"



Fix the small arena test to just check for the symptom of the infinite
loop (i.e. initialized set on failure), rather than the actual infinite
loop. This avoids some valgrind errors.

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
Reviewed-by: default avatarAndy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3512)
parent a486561b
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -68,12 +68,15 @@ static int test_sec_mem(void)
    TEST_ptr_null(OPENSSL_secure_malloc((size_t)-1));
    TEST_true(CRYPTO_secure_malloc_done());

    TEST_info("Possible infinite loop: small arena");
    if (!TEST_false(CRYPTO_secure_malloc_init(16, 16)))
        goto end;
    TEST_false(CRYPTO_secure_malloc_initialized());
    TEST_ptr_null(OPENSSL_secure_malloc((size_t)-1));
    /*
     * If init fails, then initialized should be false, if not, this
     * could cause an infinite loop secure_malloc, but we don't test it
     */
    if (TEST_false(CRYPTO_secure_malloc_init(16, 16)) &&
        !TEST_false(CRYPTO_secure_malloc_initialized())) {
        TEST_true(CRYPTO_secure_malloc_done());
        goto end;
    }

    /*-
     * There was also a possible infinite loop when the number of