]> sourceware.org Git - glibc.git/commitdiff
Missing ENOMEM in realloc_check wrapper (bug 27870)
authorAndreas Schwab <schwab@linux-m68k.org>
Mon, 17 May 2021 12:00:19 +0000 (14:00 +0200)
committerAndreas Schwab <schwab@linux-m68k.org>
Mon, 17 May 2021 19:39:23 +0000 (21:39 +0200)
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/Makefile
malloc/hooks.c

index afcd296ef6bcb85cb994db14b254587fbeff055c..857e2ebbd9967a3af02ea503ee6e3db6eb2d716e 100644 (file)
@@ -72,7 +72,7 @@ test-srcs = tst-mtrace
 # with MALLOC_CHECK_=3 because they expect a specific failure.
 tests-exclude-mcheck = tst-mcheck tst-malloc-usable \
        tst-interpose-nothread tst-interpose-static-nothread \
-       tst-interpose-static-thread tst-malloc-too-large \
+       tst-interpose-static-thread \
        tst-mxfast tst-safe-linking
 
 # Run all tests with MALLOC_CHECK_=3
index c91f9502ba80c52045ef168c91f6ad22ebeee4de..8080c3f40ea51eb4788288b3cc48631ed4fbd087 100644 (file)
@@ -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);
 
This page took 0.039087 seconds and 5 git commands to generate.