Commit 95acbe6b4e for openssl.org
commit 95acbe6b4e698fd7ecd71599467cfb12acdc1f6d
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date: Tue May 12 14:41:16 2026 +0200
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 <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
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 cef1271f78..600d4fc4d0 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 {