patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     1 diff -ur glibc-2.1.3.orig/malloc/malloc.c glibc-2.1.3/malloc/malloc.c
     2 --- glibc-2.1.3.orig/malloc/malloc.c	Wed Feb 23 10:02:55 2000
     3 +++ glibc-2.1.3/malloc/malloc.c	Thu Aug  1 09:24:10 2002
     4 @@ -3656,12 +3656,20 @@
     5  {
     6    arena *ar_ptr;
     7    mchunkptr p, oldtop;
     8 -  INTERNAL_SIZE_T sz, csz, oldtopsize;
     9 +  INTERNAL_SIZE_T bytes, sz, csz, oldtopsize;
    10    Void_t* mem;
    11  
    12 +  /* size_t is unsigned so the behavior on overflow is defined;
    13 +   * request2size() uses similar post-checks anyway. */
    14 +  bytes = n * elem_size;
    15 +  if ((n | elem_size) >= 65536 && elem_size && bytes / elem_size != n) {
    16 +    __set_errno (ENOMEM);
    17 +    return 0;
    18 +  }
    19 +
    20  #if defined _LIBC || defined MALLOC_HOOKS
    21    if (__malloc_hook != NULL) {
    22 -    sz = n * elem_size;
    23 +    sz = bytes;
    24  #if defined __GNUC__ && __GNUC__ >= 2
    25      mem = (*__malloc_hook)(sz, __builtin_return_address (0));
    26  #else
    27 @@ -3678,7 +3686,7 @@
    28    }
    29  #endif
    30  
    31 -  if(request2size(n * elem_size, sz))
    32 +  if(request2size(bytes, sz))
    33      return 0;
    34    arena_get(ar_ptr, sz);
    35    if(!ar_ptr)