From c6b6b4f2c7ff62abf5da617bff9d8080631993c0 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 17 May 2021 14:00:19 +0200 Subject: Missing ENOMEM in realloc_check wrapper (bug 27870) When MALLOC_CHECK_ is non-zero, the realloc hook missed to set errno to ENOMEM when called with too big size. Run the test tst-malloc-too-large also with MALLOC_CHECK_=3 to catch that. --- malloc/hooks.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'malloc/hooks.c') diff --git a/malloc/hooks.c b/malloc/hooks.c index c91f950..8080c3f 100644 --- a/malloc/hooks.c +++ b/malloc/hooks.c @@ -321,7 +321,10 @@ realloc_check (void *oldmem, size_t bytes, const void *caller) const INTERNAL_SIZE_T oldsize = chunksize (oldp); if (!checked_request2size (rb, &chnb)) - goto invert; + { + __set_errno (ENOMEM); + goto invert; + } __libc_lock_lock (main_arena.mutex); -- cgit v1.1