From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 11C8E3857359; Sat, 22 Oct 2022 05:35:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11C8E3857359 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666416915; bh=QWcV8xYTtYwv4YGCjfUEmYYG9qVVb9/k/6Wyt2u+rOA=; h=From:To:Subject:Date:From; b=xHcl+ORYudldR316LecxkSyG1MLIhOHWgMyY+zRRYuI/w0OpiBVgazX9GudlDnfsY SBKsdbc0remUpv3yKtFQf5ZK1frqCFMeK27kkavgeMGNL/scZw30APfvl6haNqm+ut VyvtooXxvVRnEOe4Xg2eNXWwP1jbV1AeFEZRcspk= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir' X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 8c87ffd372232476ac5d1705dd32ddda54134c2b X-Git-Newrev: 7589034cc3151bfac8cc3d3af5e91402a78e160b Message-Id: <20221022053515.11C8E3857359@sourceware.org> Date: Sat, 22 Oct 2022 05:35:15 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D7589034cc31= 51bfac8cc3d3af5e91402a78e160b commit 7589034cc3151bfac8cc3d3af5e91402a78e160b Author: Takashi Yano Date: Sat Oct 22 14:05:40 2022 +0900 Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir' =20 - If the command executed is 'cmd.exe /c [...]', runpath in spawn.cc will be NULL. In this case, is_console_app(runpath) check causes access violation. This case also the command executed is obviously console app., therefore, treat it as console app to fix this issue. =20 Addresses: https://github.com/msys2/msys2-runtime/issues/108 Diff: --- winsup/cygwin/spawn.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 5aa52ab1e..4fc842a2b 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -215,6 +215,8 @@ handle (int fd, bool writing) static bool is_console_app (WCHAR *filename) { + if (filename =3D=3D NULL) + return true; /* The command executed is command.com or cmd.exe. */ HANDLE h; const int id_offset =3D 92; h =3D CreateFileW (filename, GENERIC_READ, FILE_SHARE_READ,