summaryrefslogtreecommitdiff
path: root/patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-02-24 11:00:05 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-02-24 11:00:05 (GMT)
commit1906cf93f86d8d66f45f90380a8d3da25c087ee5 (patch)
tree90916c99abe1f1ec26709ee420e6c349eda4670a /patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch
parent2609573aede4ce198b3462976725b25eb1637d2e (diff)
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... :-(
Diffstat (limited to 'patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch')
-rw-r--r--patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch b/patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch
new file mode 100644
index 0000000..5459365
--- /dev/null
+++ b/patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch
@@ -0,0 +1,35 @@
+diff -ur glibc-2.1.3.orig/malloc/malloc.c glibc-2.1.3/malloc/malloc.c
+--- glibc-2.1.3.orig/malloc/malloc.c Wed Feb 23 10:02:55 2000
++++ glibc-2.1.3/malloc/malloc.c Thu Aug 1 09:24:10 2002
+@@ -3656,12 +3656,20 @@
+ {
+ arena *ar_ptr;
+ mchunkptr p, oldtop;
+- INTERNAL_SIZE_T sz, csz, oldtopsize;
++ INTERNAL_SIZE_T bytes, sz, csz, oldtopsize;
+ Void_t* mem;
+
++ /* size_t is unsigned so the behavior on overflow is defined;
++ * request2size() uses similar post-checks anyway. */
++ bytes = n * elem_size;
++ if ((n | elem_size) >= 65536 && elem_size && bytes / elem_size != n) {
++ __set_errno (ENOMEM);
++ return 0;
++ }
++
+ #if defined _LIBC || defined MALLOC_HOOKS
+ if (__malloc_hook != NULL) {
+- sz = n * elem_size;
++ sz = bytes;
+ #if defined __GNUC__ && __GNUC__ >= 2
+ mem = (*__malloc_hook)(sz, __builtin_return_address (0));
+ #else
+@@ -3678,7 +3686,7 @@
+ }
+ #endif
+
+- if(request2size(n * elem_size, sz))
++ if(request2size(bytes, sz))
+ return 0;
+ arena_get(ar_ptr, sz);
+ if(!ar_ptr)