This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH fifo 1/2] Cygwin: FIFO: avoid crashes when cloning a client
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin-patches at cygwin dot com" <cygwin-patches at cygwin dot com>
- Date: Mon, 25 Mar 2019 23:06:09 +0000
- Subject: [PATCH fifo 1/2] Cygwin: FIFO: avoid crashes when cloning a client
- References: <20190325230556.2219-1-kbrown@cornell.edu>
fhandler_fifo::clone called fhandler_base::clone on each client
fhandler. But those fhandlers are actually fhandler_fifo objects, so
when fhandler_base::clone calls copyto, it's actually
fhandler_fifo::copyto that gets called. This can lead to mysterious
crashes.
Fix this by simply calling clone (which translates to
fhandler_fifo::clone) on each client fhandler.
---
winsup/cygwin/fhandler.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index f6982f0ba..ef34f9c40 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1316,7 +1316,7 @@ public:
fhandler_fifo *fhf = new (ptr) fhandler_fifo (ptr);
copyto (fhf);
for (int i = 0; i < nclients; i++)
- fhf->client[i].fh = client[i].fh->fhandler_base::clone ();
+ fhf->client[i].fh = client[i].fh->clone ();
return fhf;
}
};
--
2.17.0