You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=<Date2019-07-23.15:42:40.216>created_at=<Date2017-05-02.17:46:07.589>labels= ['easy', 'expert-IO', '3.7', 'OS-windows', 'type-crash']
title='Access violation due to CancelSynchronousIo of console read'updated_at=<Date2019-07-23.15:42:40.215>user='https://github.com/eryksun'
When ReadConsole is canceled by CancelSynchronousIo 1, for some reason the call still succeeds. It's probably related to the hack that maps STATUS_ALERTED to ERROR_OPERATION_ABORTED when a console read is interrupted by Ctrl+C.
The problem is that, when canceled, ReadConsole doesn't update the value of lpNumberOfCharsRead. Thus in read_console_w in Modules/_io/winconsoleio.c, the value of n is a random number that gets added to readlen, which is subsequently used to index into buf. The problem is the same for n_read in _PyOS_WindowsConsoleReadline.
Breakpoint 0 hit
00007ffc`fb558200 4053 push rbx
00007ffc`fb5d2672 c3 ret
0:000> r rax
0:000> ?? @$teb->LastErrorValue == 995
00000000`6e43a483 85c0 test eax,eax
0:000> ?? n
unsigned long 0xefdc39e8
(1154.11fc): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
00000000`6e43a517 66833a0a cmp word ptr [rdx],0Ah
If the value of n is initialized to (DWORD)-1, then checking for a failed or canceled call could be implemented as follows: