mirror of git://sourceware.org/git/glibc.git
Handle large requests.
This commit is contained in:
parent
45db99c7d0
commit
3b11189345
|
|
@ -1,5 +1,8 @@
|
||||||
2010-10-03 Ulrich Drepper <drepper@gmail.com>
|
2010-10-03 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
[BZ #12005]
|
||||||
|
* malloc/mcheck.c: Handle large requests.
|
||||||
|
|
||||||
[BZ #12077]
|
[BZ #12077]
|
||||||
* sysdeps/x86_64/strcmp.S: Fix handling of remaining bytes in buffer
|
* sysdeps/x86_64/strcmp.S: Fix handling of remaining bytes in buffer
|
||||||
for strncmp and strncasecmp.
|
for strncmp and strncasecmp.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
/* Standard debugging hooks for `malloc'.
|
/* 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.
|
This file is part of the GNU C Library.
|
||||||
Written May 1989 by Mike Haertel.
|
Written May 1989 by Mike Haertel.
|
||||||
|
|
||||||
|
|
@ -25,6 +26,7 @@
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
|
# include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Old hook values. */
|
/* Old hook values. */
|
||||||
|
|
@ -209,6 +211,12 @@ mallochook (__malloc_size_t size, const __ptr_t caller)
|
||||||
if (pedantic)
|
if (pedantic)
|
||||||
mcheck_check_all ();
|
mcheck_check_all ();
|
||||||
|
|
||||||
|
if (size > ~((size_t) 0) - (sizeof (struct hdr) + 1))
|
||||||
|
{
|
||||||
|
__set_errno (ENOMEM);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
__malloc_hook = old_malloc_hook;
|
__malloc_hook = old_malloc_hook;
|
||||||
if (old_malloc_hook != NULL)
|
if (old_malloc_hook != NULL)
|
||||||
hdr = (struct hdr *) (*old_malloc_hook) (sizeof (struct hdr) + size + 1,
|
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;
|
slop = (sizeof *hdr + alignment - 1) & -alignment;
|
||||||
|
|
||||||
|
if (size > ~((size_t) 0) - (slop + 1))
|
||||||
|
{
|
||||||
|
__set_errno (ENOMEM);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
__memalign_hook = old_memalign_hook;
|
__memalign_hook = old_memalign_hook;
|
||||||
if (old_memalign_hook != NULL)
|
if (old_memalign_hook != NULL)
|
||||||
block = (*old_memalign_hook) (alignment, slop + size + 1, caller);
|
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)
|
if (pedantic)
|
||||||
mcheck_check_all ();
|
mcheck_check_all ();
|
||||||
|
|
||||||
|
if (size > ~((size_t) 0) - (sizeof (struct hdr) + 1))
|
||||||
|
{
|
||||||
|
__set_errno (ENOMEM);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
hdr = ((struct hdr *) ptr) - 1;
|
hdr = ((struct hdr *) ptr) - 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue