delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/15/04:18:49

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=lC10Cpf9Uv51XJbKjjwrTkU5zp4z6Xg6EMtRQ62K3lK1uKkvfESqD
KpBgWB0nnO2Bi+jW0XP/N+biA1/Hjpile0ac70oGNDY3opUi/vz0XD+Mx5PTFNhy
rBCnl9Vnz68Wk9u1LHt7Q5THa+rG3S8y6Ur8zbKdfv266C36NEci4A=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=yXxC7FHi2jR+9K84eP/QhnAN0ck=; b=uzQIDeyRjVpDGAaIsZJQw54eBVdv
c1MYiV4mHVmFIMx7XfhENsJzuNy8biM7zMzGFGsO+tsXs+4eqpwz6iY/qeliz/T2
sI042c2eTrLps4kyu9X//iWbRF1CgKdxcHuLwlRkzLNnuUKEwSaxKuQb+cA/QCXi
2yjACAquH37J2C0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Tue, 15 Oct 2013 10:18:29 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin64: allocating too much memory causes a crash (corrected)
Message-ID: <20131015081829.GA19383@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <lhgu299sucj7inkevs5h0plt38emrpmos4 AT 4ax DOT com>
MIME-Version: 1.0
In-Reply-To: <lhgu299sucj7inkevs5h0plt38emrpmos4@4ax.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--ZPt4rx8FFjLCG7dd
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sep 10 18:02, Bengt Larsson wrote:
> (I'm sorry I attached the wrong file. This should be right.)
>=20
> 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...

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--ZPt4rx8FFjLCG7dd
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQIcBAEBAgAGBQJSXPpVAAoJEPU2Bp2uRE+gP9sP/A+vBN25rJayvFUfA9YeQGLn
GBjBtyPZVcyV+lJtGfqQRHihxiqdzxCXlPkoRV9NzQFyy10VUrYDkjS6++6Ts98v
aSTTsZGD1JUNkgEhJXtMwSO7T10WD5Vbr5AFSqvj1xzml/8vpEJMwjTYOaLihDa0
8Xc/KILELSQpcsUub/g3n2nppXUJaNn08qJCbKEsqMCjukBHYBDhuNZlOgNVi5gB
QYRmezuNZegS7gRnwGntX0BU2l5D+nyqvPqAGQ0acP0LFEnm7GemoQd47gLq6FVi
SI3kR90CcrKTmBcRpVmh0fWIseTeMT9GpHS2l4I8+4bg5qd2nYF9+c4rSRHRrKT6
GDv4ZGjGvlkBdM1y1VJXUkdkHHgul6BzyY+fzmPVyvkgRbhwC61+DRdjerJUmVuK
WwuN8rNjR5ORmxLkBTD/AZJNypl8N9CKx+USs2LIYo2eH/0EMBfNBBzo2Hguqnoo
Joty5a1fxs9sTzZ+vOHtCnrwq0YFdeXC1bn+ZyrkB7ft0NU9aahXV+MpbLKY8aiD
Sm1FOWtQXyxhww0Glc4lVPUd7+WsMLtzfTEx5IxprHXaxxj4+bVCzb7qEcxGAId8
Pg+x8UbAbqvMdWAEOhHT0nui3EN+2ImyUwZKnXXsevim9n5Du+ctCRUby82Xoqvl
tIm0EHmze+A3OIkSG30g
=H1GW
-----END PGP SIGNATURE-----

--ZPt4rx8FFjLCG7dd--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019