Date: Mon, 2 Jul 2001 18:19:36 -0400 Message-Id: <200107022219.SAA04299@envy.delorie.com> X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f From: DJ Delorie To: djgpp AT delorie DOT com CC: sokal AT holyrood DOT ed DOT ac DOT uk In-reply-to: (message from Daniel Barker on Mon, 2 Jul 2001 22:55:15 +0100) Subject: Re: malloc() problem, DJDEV 203 References: Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > I noticed this whilst checking a test I have written for my own > malloc() wrapper function. malloc() does not indicate failure for a > very large allocation. Try -8 instead of -1, although size_t is unsigned, so you really should use 4294967288U, not -8. Your request is (humorously) getting rounded up (to a 8-byte boundary) from 4294967295U (-1) to 4294967296U (0), and 0 is a valid request to malloc. It would be trivial to add a check for values 4294967289U through 4294967295U in djgpp's src/libc/ansi/stdlib/malloc.c if someone wants to use this as an excuse to get into djgpp development ;-)