]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* malloc/malloc.c (_int_free): Fail if block size is obviously wrong.
authorUlrich Drepper <drepper@redhat.com>
Thu, 13 Oct 2005 04:48:35 +0000 (04:48 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 13 Oct 2005 04:48:35 +0000 (04:48 +0000)
ChangeLog
malloc/malloc.c

index a956c5500268380df232afbd8b0b1f94c2a51502..6e30d38fcb0365fb87de07bd7b6832aa7748a4f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-10-12  Ulrich Drepper  <drepper@redhat.com>
 
+       * malloc/malloc.c (_int_free): Fail if block size is obviously wrong.
+
        * include/malloc.h: Remove _int_new_arena prototype.
        * malloc/arena.c (_int_new_arena): Move definition ahead of
        arena_get2 and make static.
index a8bc76739f8c860acf4c14fa3156611caf320647..4ea35254bb973eda1811db668ca03ddae589e685 100644 (file)
@@ -4278,6 +4278,12 @@ _int_free(mstate av, Void_t* mem)
       malloc_printerr (check_action, errstr, mem);
       return;
     }
+  /* We know that each chunk is at least MINSIZE bytes in size.  */
+  if (__builtin_expect (size < MINSIZE, 0))
+    {
+      errstr = "free(): invalid size";
+      goto errout;
+    }
 
   check_inuse_chunk(av, p);