[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
documentation bug?
From: |
Peter Jay Salzman |
Subject: |
documentation bug? |
Date: |
Wed, 30 Apr 2003 16:55:40 -0700 |
User-agent: |
Mutt/1.5.3i |
hello all,
i'm using sarge (glibc 2.3.1). according to the libc info page:
When `MALLOC_CHECK_' is set, a special (less efficient) implementation
is used which is designed to be tolerant against simple errors, such as
double calls of `free' with the same argument, or overruns of a single
byte (off-by-one bugs). Not all such errors can be protected against,
however, and memory leaks can result.
i think the info page is wrong about being tolerant against simple
errors, such as double free's and off-by-one overflows.
in every test i've made, setting MALLOC_CHECK_ to 3 caught double free's
and off-by-one overflows, in code as simple as:
#include <stdlib.h>
int main(void)
{
int *p = (int *) malloc(sizeof(int));
p[1] = 0;
return 0;
}
or
#include <stdlib.h>
int main(void)
{
int *p = (int *) malloc(sizeof(int));
free(p);
free(p);
return 0;
}
is the word "tolerant" a typo? seems like it should say:
When `MALLOC_CHECK_' is set, a special (less efficient) implementation
is used which is designed to catch simple errors, such as double calls
of `free' with the same argument, or overruns of a single byte
(off-by-one bugs). Not all such errors can be protected against,
however, and memory leaks can result.
hate to bother developers with a boring documentation problem, but i'm
kind of wondering about this.
i'm not on the mailing list, so please cc me.
thanks guys!
pete
--
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
pgpcyoZ_L0GrG.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- documentation bug?,
Peter Jay Salzman <=