Re: Segmentation fault due to double free for archetype.

2022-01-17 Thread Corinna Vinschen
On Jan 17 21:48, Takashi Yano wrote: > On Mon, 17 Jan 2022 13:11:46 +0100 > Corinna Vinschen wrote: > > if (!(res = (archetype && archetype->io_handle) > > || open (flags, mode & 0))) > > > > Then the archetype is one already created by a former open_with_arch > > call and then you d

Re: Segmentation fault due to double free for archetype.

2022-01-17 Thread Takashi Yano
On Mon, 17 Jan 2022 13:11:46 +0100 Corinna Vinschen wrote: > On Jan 17 20:41, Takashi Yano wrote: > > On Mon, 17 Jan 2022 12:01:51 +0100 > > Corinna Vinschen wrote: > > > On Jan 15 19:20, Takashi Yano wrote: > > > > I also found the following patch fixes the issue. Is this the > > > > right thing?

Re: Segmentation fault due to double free for archetype.

2022-01-17 Thread Corinna Vinschen
On Jan 17 20:41, Takashi Yano wrote: > On Mon, 17 Jan 2022 12:01:51 +0100 > Corinna Vinschen wrote: > > On Jan 15 19:20, Takashi Yano wrote: > > > I also found the following patch fixes the issue. Is this the > > > right thing? > > > > > > diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fha

Re: Segmentation fault due to double free for archetype.

2022-01-17 Thread Takashi Yano
On Mon, 17 Jan 2022 12:01:51 +0100 Corinna Vinschen wrote: > On Jan 15 19:20, Takashi Yano wrote: > > I also found the following patch fixes the issue. Is this the > > right thing? > > > > diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc > > index fc7c0422e..e51208117 100644 > >

Re: Segmentation fault due to double free for archetype.

2022-01-17 Thread Corinna Vinschen
On Jan 15 19:20, Takashi Yano wrote: > Hi, > > I found the following test case causes segmentation fault > in 32 bit cygwin. > [...] > I looked into this problem and found that this is due to > free'ing archetype which was already free'ed by _cfree(). > > The mechanism of the problem is: > 1) arc

Segmentation fault due to double free for archetype.

2022-01-15 Thread Takashi Yano
Hi, I found the following test case causes segmentation fault in 32 bit cygwin. #include #include #include int main() { for (int i = 0; i < 256; i++) { printf("\r%d, %d\n", i, open("/dev/ptmx", O_RDWR | O_NOCTTY)); } return 0; } The test case results