Cygwin: console: Fix segfault on shared_console_info access.
- Accessing shared_console_info before initialization causes access violation because 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() when it is called from close(). This patch makes sure that shared_console_info is not NULL before calling request_xterm_mode_output().
This commit is contained in:
parent
86f9ce97bc
commit
17528b9d2c
@ -1159,18 +1159,17 @@ fhandler_console::close ()
|
|||||||
|
|
||||||
acquire_output_mutex (INFINITE);
|
acquire_output_mutex (INFINITE);
|
||||||
|
|
||||||
if (shared_console_info && myself->pid == con.owner &&
|
if (shared_console_info && wincap.has_con_24bit_colors ())
|
||||||
wincap.has_con_24bit_colors () && !con_is_legacy)
|
{
|
||||||
request_xterm_mode_output (false);
|
/* Restore console mode if this is the last closure. */
|
||||||
|
OBJECT_BASIC_INFORMATION obi;
|
||||||
/* Restore console mode if this is the last closure. */
|
NTSTATUS status;
|
||||||
OBJECT_BASIC_INFORMATION obi;
|
status = NtQueryObject (get_handle (), ObjectBasicInformation,
|
||||||
NTSTATUS status;
|
&obi, sizeof obi, NULL);
|
||||||
status = NtQueryObject (get_handle (), ObjectBasicInformation,
|
if ((NT_SUCCESS (status) && obi.HandleCount == 1)
|
||||||
&obi, sizeof obi, NULL);
|
|| myself->pid == con.owner)
|
||||||
if (NT_SUCCESS (status) && obi.HandleCount == 1)
|
request_xterm_mode_output (false);
|
||||||
if (wincap.has_con_24bit_colors ())
|
}
|
||||||
request_xterm_mode_output (false);
|
|
||||||
|
|
||||||
release_output_mutex ();
|
release_output_mutex ();
|
||||||
|
|
||||||
|
@ -5,3 +5,7 @@ Bug Fixes:
|
|||||||
Don't move cursor to the right in case of a NUL character in the console
|
Don't move cursor to the right in case of a NUL character in the console
|
||||||
output stream, this is not backed by terminfo.
|
output stream, this is not backed by terminfo.
|
||||||
Addresses: https://cygwin.com/ml/cygwin/2020-02/msg00162.html
|
Addresses: https://cygwin.com/ml/cygwin/2020-02/msg00162.html
|
||||||
|
|
||||||
|
- Fix a segfault when starting, e.g., mintty from a bash in a console
|
||||||
|
running xterm emulation.
|
||||||
|
Addresses: https://cygwin.com/ml/cygwin/2020-02/msg00197.html
|
||||||
|
Loading…
x
Reference in New Issue
Block a user