This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: some ftpd implementations mishandle CWD ~{


> "Gregory A Lundberg" <lundberg@vr.net> writes:
> 
> >     p = calloc(ULONG_MAX, ULONG_MAX);
> >     assert(p == NULL);
> $ ./a.out 
> a.out: malloc-test.c:21: main: Assertion `p == ((void *)0)' failed.
> Aborted
> 
> Wolfram,
> 
> this doesn't look right, can you look into it, please?

Argl, this is a stupid situation.  I'm not unwilling to add yet
another overflow check in calloc, but -- at the cost of a division?

Is there a portable check that for "size_t a, b;" (assume b>0) "a*b"
overflows other than something horrible like

if ((a*b)/b != a) ...

Any ideas?

Regards,
Wolfram.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]