delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/12/31/12:50:17

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-9.6 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <50E1D039.7050200@redhat.com>
Date: Mon, 31 Dec 2012 10:49:45 -0700
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: dup2() dumps core on corner case
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes
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

--------------enig289A62D41C6A60FB5938AC5D
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Detected by gnulib's unit tests.  STC:

$ cat foo.c
#include <unistd.h>
int main() {
  return dup2(0, -1);
}
$ gcc -o foo -g -Wall foo.c
$ ./foo
Segmentation fault (core dumped)

cygwin 1.7.17-1

Running under gdb shows:
      4 [main] foo 1220 exception::handle: Exception:
STATUS_ACCESS_VIOLATION
    702 [main] foo 1220 open_stackdumpfile: Dumping stack trace to
foo.exe.stackdump

Program received signal SIGSEGV, Segmentation fault.
0x610e9407 in dup2 () from /usr/bin/cygwin1.dll

Expected results should be a normal failure with EBADF in errno.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--------------enig289A62D41C6A60FB5938AC5D
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBCAAGBQJQ4dA5AAoJEKeha0olJ0Nqf9sH/0gUZcMfosCp7Jh2j4Pssriv
gBfSwZNv6nGUTVKP1ZN9PoF9+hh9YlwA6MfnjV+FW6PDseLn3DRgtI/vjSfpYGn+
hF5vG2PKq/hCTKfyxG9QcTYZyYsrpN/wHfyGeJPKmtOfJLAIqeMfMUcLMWQ7ZCyM
nxFBF+cq+yi4TO2+/LEcTaNMCr1YRTF8C+hvJsomc/bx+ZZctAk2RSH+2qv8AcJn
3FqiE+YLN18x8zCHHK3Lcdt6qcvOTH7oWWiLxu0GzvClfivvgR/2H4fdTDR3tjgz
p7fcsqftrQAqxaYgJtqsxNQKJ0g+V4urZg+XhIpK6FEna3SxI8oAklz38dVlYAs=
=jm4/
-----END PGP SIGNATURE-----

--------------enig289A62D41C6A60FB5938AC5D--

- Raw text -


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