conhost.exe heap corruption in COOKED_READ_DATA::_handlePostCharInputLoop #13281

Open
opened 2026-01-31 03:38:36 +00:00 by claunia · 0 comments
Owner

Originally created by @emmett-b on GitHub (Apr 2, 2021).

Originally assigned to: @zadjii-msft on GitHub.

Windows Terminal version (or Windows build number)

Windows Terminal 1.6.10571.0
OS Build 21343.10000

Other Software

My awful cmd wrapper (attempt at a terminal emulator) written in a weekend 3 years ago. A pyramid of hacks that seems to fuzz the new conhost enough to make it crash. Wasn't crashing before, apparently until I upgraded to Windows 10 insider dev channel.

Steps to reproduce

Not clear yet but my cmd wrapper has multiple threads calling into ReadConsoleOutput, GetConsoleScreenBufferInfo, WriteConsoleInput many times. Looks like it's triggered by successive calls to GetConsoleScreenBufferInfo and then WriteConsoleInput.

Expected Behavior

no crash

Actual Behavior

Heap corruption. Attaching a debugger showed that it was crashing during a call to free which ended up in ntdll!RtlpHeapFindListLookupEntry. I then enabled app verifier for conshost.exe and then it crashed in memcpy called by COOKED_READ_DATA::_handlePostCharInputLoop. So this likely where the heap corruption happens.

Originally created by @emmett-b on GitHub (Apr 2, 2021). Originally assigned to: @zadjii-msft on GitHub. ### Windows Terminal version (or Windows build number) Windows Terminal 1.6.10571.0 OS Build 21343.10000 ### Other Software My awful cmd wrapper (attempt at a terminal emulator) written in a weekend 3 years ago. A pyramid of hacks that seems to fuzz the new conhost enough to make it crash. Wasn't crashing before, apparently until I upgraded to Windows 10 insider dev channel. ### Steps to reproduce Not clear yet but my cmd wrapper has multiple threads calling into ReadConsoleOutput, GetConsoleScreenBufferInfo, WriteConsoleInput many times. Looks like it's triggered by successive calls to GetConsoleScreenBufferInfo and then WriteConsoleInput. ### Expected Behavior no crash ### Actual Behavior Heap corruption. Attaching a debugger showed that it was crashing during a call to free which ended up in ntdll!RtlpHeapFindListLookupEntry. I then enabled app verifier for conshost.exe and then it crashed in memcpy called by COOKED_READ_DATA::_handlePostCharInputLoop. So this likely where the heap corruption happens.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13281