From: Eugene Syromiatnikov Date: Tue, 12 May 2026 12:41:16 +0000 (+0200) Subject: test/mem_alloc_test.c: increase alloc size for triggering OOM malloc failure X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=95acbe6b4e698fd7ecd71599467cfb12acdc1f6d;p=thirdparty%2Fopenssl.git test/mem_alloc_test.c: increase alloc size for triggering OOM malloc failure While half of the address space is enough to make malloc() fail on kernels of the same bitness, 32-bit compat can have enough to accommodate such a request, and even three fourth of the address space. Bump the requested size closer to the type's upper limit. Fixes: d090695101a9 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov Reviewed-by: Tomas Mraz Reviewed-by: Nikola Pajkovsky MergeDate: Mon May 18 07:30:48 2026 (Merged from https://github.com/openssl/openssl/pull/31158) --- diff --git a/test/mem_alloc_test.c b/test/mem_alloc_test.c index cef1271f788..600d4fc4d00 100644 --- a/test/mem_alloc_test.c +++ b/test/mem_alloc_test.c @@ -78,7 +78,7 @@ static const struct array_alloc_vector { { 1, 1, EXP_NONNULL, EXP_NONNULL }, - { SQRT_SIZE_T / 2, SQRT_SIZE_T, EXP_OOM, EXP_OOM }, + { SQRT_SIZE_T - 1, SQRT_SIZE_T - 1, EXP_OOM, EXP_OOM }, { SQRT_SIZE_T, SQRT_SIZE_T, EXP_ZERO_SIZE, EXP_INT_OF }, @@ -88,8 +88,6 @@ static const struct array_alloc_vector { #else /* Of course there are no archutectures other than 32- and 64-bit ones */ { 274177, 67280421310721LLU, EXP_NONNULL, EXP_INT_OF }, #endif - - { SIZE_MAX / 4 * 3, SIZE_MAX / 2, EXP_OOM, EXP_INT_OF }, }; static const struct array_realloc_vector {