This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin64: allocating too much memory causes a crash (corrected)


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

Attachment: pgpjSlElicvw3.pgp
Description: PGP signature


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