This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: malloc(0) crashing with SIGABRT
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Cc: Petr Skočík <pskocik at gmail dot com>
- Date: Thu, 12 Sep 2019 16:12:36 +0000
- Subject: Re: malloc(0) crashing with SIGABRT
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=97vbvUiFpTkiHa6o5fWtGBwDRzoce2kXU94yyAZXWmU=; b=h3Az6CV2z68PKfaGimsMM32FwrPO821wp0gemWPNpbBbjKY/uQcht45Nf2WWEs58Wjt28Hc/5G90zI3voiY8v7QKBRbPJNMUOg0TfhW5GHCY4R+YoFQm46Vf3ggK6cQsUQ+oEmaopnlJ/VRnLgpqvcpF+5L1t/nRts0HOScmXIsDj8RvrRQnAz0YvPQdG0Y1ixKwrdVmk/CzWwnvYupbawdm5T7ltlNO++W/YDUw0xHnNNfq1tz7sgM8apfG7B8CnMqTyDOQb9MAApzY+ZgCuQ/61Sh7rDvLmFH2YczrFL2Zy1Ask1AMOoMpd84opBlEyHKl43ABG5U+ktLCI+oM7Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lKHH3oyP1B8zlu2RhyY3a9CfqeS2MdPPAfcyeUT9cJTp0AzBM4P+2AgmMVnU95s7Nrz1vN7mBu/FdSHadrXWRy665NITdKnrxho4VZrRqv6unnas0MF/OsJBcvggHF6TFiOj85q1AOp9p7YAj9jTfgBjlKXHATt3ZBvj/6glC2Hbcck6s3VLIo4hDDEsz6eRLkK3wscQPhBXo4TA7N/VSsTse2Hxt0rNpnbwtk1ZtEXtg6INjGvhDM1HQTKHwIngle2p6GWQ+msPQ0oBwxoClmSdA3MhAJGzIcsnlu4whFRXoyjiGnUdU5FdbgHLlGK5sXqhVZbvuMcBBNQRQcjvaQ==
- References: <366918d8-b505-45be-dc28-303579f17341@gmail.com> <78e19eb7-956e-cd05-a076-e56ce347bbbe@gmail.com>
On 9/9/2019 1:13 PM, Petr Skočík wrote:
> There's been a twitter discussion on how different POSIX platforms
> handle malloc(0): https://twitter.com/sortiecat/status/1170697927804817412 .
>
> As for Cygwin, the answer appears to be "not well", but this should be
> easy to fix.
Can you show how you produced a crash? It works fine for me with the following
test program:
$ cat malloc_zero.c
#include <stdlib.h>
#include <stdio.h>
int
main ()
{
printf ("malloc (0) = %p\n", malloc (0));
}
$ gcc -Wall -o malloc_zero malloc_zero.c
$ ./malloc_zero.exe
malloc (0) = 0x8000003c0
[This is on 64-bit Cygwin. It's the same on 32-bit, but with a different address.]
Ken
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple