mirror of
https://github.com/openssl/openssl.git
synced 2026-05-07 20:12:39 +00:00
3cff7c2181
Introduce ADD_MFAIL_TEST for exhaustive testing of allocation failure handling in individual functions. The framework repeatedly calls the test function, each time failing one allocation later within the section bracketed by mfail_start() and mfail_end(), verifying that every failure path returns 0 without crashing or leaking. Custom allocators are installed once at startup via CRYPTO_set_mem_functions(). When not armed, they pass through to malloc/realloc/free. Installation can be disabled by setting OPENSSL_TEST_MFAIL_DISABLE for tests that need the default allocator (e.g. those using OPENSSL_MALLOC_FAILURES). Additional environment variables control test execution: OPENSSL_TEST_MFAIL_SKIP_ALL, OPENSSL_TEST_MFAIL_SKIP_SLOW, OPENSSL_TEST_MFAIL_POINT, and OPENSSL_TEST_MFAIL_START. Reviewed-by: Saša Nedvědický <sashan@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.foundation> MergeDate: Thu Apr 23 20:23:34 2026 (Merged from https://github.com/openssl/openssl/pull/30871)