summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-01-30 17:47:23 +0000
committerUlrich Drepper <drepper@redhat.com>2009-01-30 17:47:23 +0000
commit1fdd89a78dfa4f0ea4b14c994a055de802e61a89 (patch)
treefb50205adf4fe547c4056a9d4731ef6a1170135f
parent8585cb7454e10346bccc9fb4df3fae51b2efb9b6 (diff)
* malloc/malloc.c (sYSMALLOc): Don't use assert when detecting
manipulated brk, use malloc_printerr. * misc/sbrk.c (__sbrk): Better error handling for nonsense requests.
-rw-r--r--ChangeLog7
-rw-r--r--NEWS7
-rw-r--r--malloc/malloc.c4
-rw-r--r--misc/sbrk.c10
4 files changed, 21 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index dbed10ac06..6169ed7615 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-30 Ulrich Drepper <drepper@redhat.com>
+
+ * malloc/malloc.c (sYSMALLOc): Don't use assert when detecting
+ manipulated brk, use malloc_printerr.
+ * misc/sbrk.c (__sbrk): Better error handling for nonsense
+ requests.
+
2009-01-30 Jakub Jelinek <jakub@redhat.com>
* string/string.h (memchr, strchr, strrchr, strpbrk, strstr, index,
diff --git a/NEWS b/NEWS
index 095dbab44e..5c2d9a7ef7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
-GNU C Library NEWS -- history of user-visible changes. 2008-12-2
-Copyright (C) 1992-2007, 2008 Free Software Foundation, Inc.
+GNU C Library NEWS -- history of user-visible changes. 2009-1-30
+Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
See the end for copying conditions.
Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
@@ -9,6 +9,9 @@ Version 2.10
* New Linux interface: accept4
+* Correct declarations of string function when used in C++ code. This
+ could lead to compile error for invalid C++ code.
+
Version 2.9
diff --git a/malloc/malloc.c b/malloc/malloc.c
index d6102a4528..a918934740 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 1996-2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1996-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>
and Doug Lea <dl@cs.oswego.edu>, 2001.
@@ -3189,7 +3189,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
else if (contiguous(av) && old_size && brk < old_end) {
/* Oops! Someone else killed our space.. Can't touch anything. */
- assert(0);
+ malloc_printerr (3, "break adjusted to free malloc space", brk);
}
/*
diff --git a/misc/sbrk.c b/misc/sbrk.c
index 0df60076cc..985b34749a 100644
--- a/misc/sbrk.c
+++ b/misc/sbrk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1995,1996,1997,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1995-1997,2000,2002,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,8 +16,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <unistd.h>
#include <errno.h>
+#include <stdint.h>
+#include <unistd.h>
/* Defined in brk.c. */
extern void *__curbrk;
@@ -47,7 +48,10 @@ __sbrk (intptr_t increment)
return __curbrk;
oldbrk = __curbrk;
- if (__brk (oldbrk + increment) < 0)
+ if ((increment > 0
+ ? ((uintptr_t) oldbrk + (uintptr_t) increment < (uintptr_t) oldbrk)
+ : ((uintptr_t) oldbrk < (uintptr_t) -increment))
+ || __brk (oldbrk + increment) < 0)
return (void *) -1;
return oldbrk;