Conhost crash when using accessibility tools #4480

Closed
opened 2026-01-30 23:48:46 +00:00 by claunia · 1 comment
Owner

Originally created by @j4james on GitHub (Oct 15, 2019).

Environment

Windows build number: Version 10.0.18362.295
Conhost build: commit df26c677ef

Any other software? Inspect from the 10.0.18362.0 SDK

Steps to reproduce

  1. Start a conhost session.
  2. Start the Inspect utility.
  3. Click on the top level window in the UI Automation tree that matches the conhost session.

Expected behavior

You should see details about the window in the right hand pane.

Actual behavior

I get an access violation in WindowUiaProviderBase::get_ProviderOptions because pOptions has a value of 0x13, which isn't a valid pointer. The crash can also happen in other places depending on what accessibility call is triggered first.

I believe this is a regression thatwas introduced in commit cdfbf8f106.

It's been a while since I've worked with COM, but I'm fairly certain you can't return an interface without a cast the way it is now being done in those QueryInterface methods. Otherwise the returned interface pointer won't be pointing to the correct vtable. And I suspect that's resulting in the wrong method being called by the code that is using the returned interface, hence the bogus parameter value (the parameter was likely intended for a completely different method).

Originally created by @j4james on GitHub (Oct 15, 2019). # Environment Windows build number: Version 10.0.18362.295 Conhost build: commit df26c677efcb815a3b66a974345c9d3483cab678 Any other software? [Inspect](https://docs.microsoft.com/en-us/windows/win32/winauto/inspect-objects) from the 10.0.18362.0 SDK # Steps to reproduce 1. Start a conhost session. 2. Start the Inspect utility. 3. Click on the top level window in the UI Automation tree that matches the conhost session. # Expected behavior You should see details about the window in the right hand pane. # Actual behavior I get an access violation in [`WindowUiaProviderBase::get_ProviderOptions`](https://github.com/microsoft/terminal/blob/429af0e6fa80412f1e9185845d856e3497a6cf78/src/types/WindowUiaProviderBase.cpp#L69) because `pOptions` has a value of 0x13, which isn't a valid pointer. The crash can also happen in other places depending on what accessibility call is triggered first. I believe this is a regression thatwas introduced in commit cdfbf8f1064db75c23f417c20c20567c3054f0ad. It's been a while since I've worked with COM, but I'm fairly certain you can't return an interface without a cast the way it is now being done in those `QueryInterface` methods. Otherwise the returned interface pointer won't be pointing to the correct vtable. And I suspect that's resulting in the wrong method being called by the code that is using the returned interface, hence the bogus parameter value (the parameter was likely intended for a completely different method).
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 15, 2019):

Yeah ☹️ this'll be fixed by #3051, but we should get something in a bit quicker.

@DHowett-MSFT commented on GitHub (Oct 15, 2019): Yeah ☹️ this'll be fixed by #3051, but we should get something in a bit quicker.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4480