Hi Takashi, On Feb 22 04:10, Takashi Yano wrote: > - Accessing shared_console_info accidentaly causes segmentation > fault when it is a NULL pointer. The cause of the problem reported > in https://cygwin.com/ml/cygwin/2020-02/msg00197.html is this NULL > pointer access in request_xterm_mode_output(). This patch fixes > the issue.
When does this occur? I guess this is during initialization. Is it
really necessary to switch to xterm mode at all at that time? If not,
it might be simpler to just
- if (con_is_legacy)
+ if (con_is_legacy || !shared_console_info)
at the start of the functions and only switch to xterm mode when
fully up and running.
> ---
> winsup/cygwin/fhandler_console.cc | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/winsup/cygwin/fhandler_console.cc
> b/winsup/cygwin/fhandler_console.cc
> index 42040a971..e298dd60c 100644
> --- a/winsup/cygwin/fhandler_console.cc
> +++ b/winsup/cygwin/fhandler_console.cc
> @@ -256,7 +256,8 @@ fhandler_console::request_xterm_mode_input (bool req)
> return;
> if (req)
> {
> - if (InterlockedIncrement (&con.xterm_mode_input) == 1)
> + if (!shared_console_info ||
> + InterlockedIncrement (&con.xterm_mode_input) == 1)
Btw., that should be
if (!shared_console_info
|| InterlockedIncrement (&con.xterm_mode_input) == 1)
Note the position of the ||
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
signature.asc
Description: PGP signature
