Open cminyard opened 2 years ago
Please provide a patch by way of a Pull Request.
The code now lives in https://github.com/cygwin/cygwin/blob/main/winsup/cygwin/fhandler/console.cc there are three buggy loops like this, two for WriteConsoleInputW and one for ReadConsoleInputW.
In winsup/cygwin/fhandler_console.cc there is the following code:
I was working on a remote login program, and it turns out that if you create a pseudo console in a higher integrity process than the process using the console, WriteConsoleInput will not work (See https://learn.microsoft.com/en-us/answers/questions/1040676/createpseudoconsole-with-reduced-integrity-level.html for details on that)
If WriteConsoleInputW() fails the above code will go into an infinite loop.
I was able to fix my program with great pain and suffering, but things like the above should be written to avoid possible infinite loops. The lack of error checking in general doesn't seem good to me.