diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-11-20 09:56:34 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-11-20 09:56:34 +0000 |
commit | 7894035e1ce51595cd0bff5727ca0297295c527e (patch) | |
tree | b8d3c92ca2e24edf75d46829d2c181472d1ec21d /malloc | |
parent | cc579e4358c4347a8610be0aa8a7a6a3e3d2fe90 (diff) | |
download | glibc-7894035e1ce51595cd0bff5727ca0297295c527e.tar.gz glibc-7894035e1ce51595cd0bff5727ca0297295c527e.tar.xz glibc-7894035e1ce51595cd0bff5727ca0297295c527e.zip |
Updated to fedora-glibc-20041120T0949
Diffstat (limited to 'malloc')
-rw-r--r-- | malloc/malloc.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index c2ec82d0c8..b62ffb57c0 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -3840,8 +3840,12 @@ _int_malloc(mstate av, size_t bytes) */ if ((unsigned long)(nb) <= (unsigned long)(av->max_fast)) { - fb = &(av->fastbins[(fastbin_index(nb))]); + long int idx = fastbin_index(nb); + fb = &(av->fastbins[idx]); if ( (victim = *fb) != 0) { + if (__builtin_expect (fastbin_index (chunksize (victim)) != idx, 0)) + malloc_printerr (check_action, "malloc(): memory corruption (fast)", + chunk2mem (victim)); *fb = victim->fd; check_remalloced_chunk(av, victim, nb); return chunk2mem(victim); @@ -3911,6 +3915,10 @@ _int_malloc(mstate av, size_t bytes) while ( (victim = unsorted_chunks(av)->bk) != unsorted_chunks(av)) { bck = victim->bk; + if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0) + || __builtin_expect (victim->size > av->system_mem, 0)) + malloc_printerr (check_action, "malloc(): memory corruption", + chunk2mem (victim)); size = chunksize(victim); /* @@ -4233,8 +4241,7 @@ _int_free(mstate av, Void_t* mem) #endif ) { - if (__builtin_expect (chunk_at_offset (p, size)->size <= 2 * SIZE_SZ, - 0) + if (__builtin_expect (chunk_at_offset (p, size)->size <= 2 * SIZE_SZ, 0) || __builtin_expect (chunksize (chunk_at_offset (p, size)) >= av->system_mem, 0)) { |