Cygwin64: allocating too much memory causes a crash (corrected)
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Oct 15 08:18:00 GMT 2013
On Sep 10 18:02, Bengt Larsson wrote:
> (I'm sorry I attached the wrong file. This should be right.)
>
> On Cygwin64, if I malloc too much memory I get a stackdump, instead of a
> NULL in return (for example testmalloc 5000000000).
Sorry for the late reply, I was abroad for a couple of weeks.
I just tried it myself and could easily reproduce the problem.
I found the culprit in mmap. It was using DWORD instead of size_t
for a variable which was used for rounding purposes. This accidentally
restricted the length of any allocation to < 4 Gigs(*). When called
from malloc, malloc would get a valid pointer, pointing to a too small
memory block. Writing the malloc fencepost then crashed.
Thanks for the report and especially the testcase! I applied a fix
and will provide a new developer snapshot with this fix on
http://cygwin.com/snapshots/ soon.
Corinna
(*) Naturally the 32 bit version would never see this problem...
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20131015/b9fcf202/attachment.sig>
More information about the Cygwin
mailing list