This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, master, updated. glibc-2.12-172-g3b11189
- From: drepper at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 4 Oct 2010 02:27:34 -0000
- Subject: GNU C Library master sources branch, master, updated. glibc-2.12-172-g3b11189
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 3b11189345d0080527a76e3bf867da395a1b0261 (commit)
from 45db99c7d03e497a3320907e722270fb7ee852f3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3b11189345d0080527a76e3bf867da395a1b0261
commit 3b11189345d0080527a76e3bf867da395a1b0261
Author: Ulrich Drepper <drepper@gmail.com>
Date: Sun Oct 3 22:27:21 2010 -0400
Handle large requests.
diff --git a/ChangeLog b/ChangeLog
index c0c1600..faf2bef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-10-03 Ulrich Drepper <drepper@gmail.com>
+ [BZ #12005]
+ * malloc/mcheck.c: Handle large requests.
+
[BZ #12077]
* sysdeps/x86_64/strcmp.S: Fix handling of remaining bytes in buffer
for strncmp and strncasecmp.
diff --git a/malloc/mcheck.c b/malloc/mcheck.c
index 524acc7..e2eb83f 100644
--- a/malloc/mcheck.c
+++ b/malloc/mcheck.c
@@ -1,5 +1,6 @@
/* Standard debugging hooks for `malloc'.
- Copyright (C) 1990-1997,1999,2000-2002,2007 Free Software Foundation, Inc.
+ Copyright (C) 1990-1997,1999,2000-2002,2007,2010
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written May 1989 by Mike Haertel.
@@ -25,6 +26,7 @@
# include <stdint.h>
# include <stdio.h>
# include <libintl.h>
+# include <errno.h>
#endif
/* Old hook values. */
@@ -209,6 +211,12 @@ mallochook (__malloc_size_t size, const __ptr_t caller)
if (pedantic)
mcheck_check_all ();
+ if (size > ~((size_t) 0) - (sizeof (struct hdr) + 1))
+ {
+ __set_errno (ENOMEM);
+ return NULL;
+ }
+
__malloc_hook = old_malloc_hook;
if (old_malloc_hook != NULL)
hdr = (struct hdr *) (*old_malloc_hook) (sizeof (struct hdr) + size + 1,
@@ -241,6 +249,12 @@ memalignhook (__malloc_size_t alignment, __malloc_size_t size,
slop = (sizeof *hdr + alignment - 1) & -alignment;
+ if (size > ~((size_t) 0) - (slop + 1))
+ {
+ __set_errno (ENOMEM);
+ return NULL;
+ }
+
__memalign_hook = old_memalign_hook;
if (old_memalign_hook != NULL)
block = (*old_memalign_hook) (alignment, slop + size + 1, caller);
@@ -276,6 +290,12 @@ reallochook (__ptr_t ptr, __malloc_size_t size, const __ptr_t caller)
if (pedantic)
mcheck_check_all ();
+ if (size > ~((size_t) 0) - (sizeof (struct hdr) + 1))
+ {
+ __set_errno (ENOMEM);
+ return NULL;
+ }
+
if (ptr)
{
hdr = ((struct hdr *) ptr) - 1;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 3 +++
malloc/mcheck.c | 22 +++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletions(-)
hooks/post-receive
--
GNU C Library master sources