The fhandler_base_overlapped::copyto clears atomic_write_buf on the
clone, but none of the derived classes were doing this. This allowed
the destructor to double-free the buffer and corrupt cygheap.
Clear atomic_write_buf in copyto of all derived classes.
{
x->pc.free_strings ();
*reinterpret_cast<fhandler_pipe *> (x) = *this;
+ reinterpret_cast<fhandler_pipe *> (x)->atomic_write_buf = NULL;
x->reset (this);
}
{
x->pc.free_strings ();
*reinterpret_cast<fhandler_fifo *> (x) = *this;
+ reinterpret_cast<fhandler_fifo *> (x)->atomic_write_buf = NULL;
x->reset (this);
}
- Return ESPIPE rather than EINVAL from lseek on a fifo.
Addresses: https://cygwin.com/ml/cygwin/2018-10/msg00019.html
+
+- Fix a memory corruption when using pipes or FIFOs
+ Addresses: https://cygwin.com/ml/cygwin-patches/2018-q4/msg00000.html