MicrosoftEdge / MicrosoftEdge/WebView2Samples

EnsureProcessIsClosed function missing correct access rights and does not close handle

Open
#249 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1k
Forks
521
Avg merge
13m
Merged PRs (30d)
1

Description

The process handle that gets passed to WaitForSingleObject in this line is missing the SYNCHRONIZE access right as specified here. This needs to be requested in the adjacent OpenProcess call alongside the PROCESS_TERMINATE access right.

This results in the WaitForSingleObject call to always immediately return with a result that always leads to the explicit forceful termination code path. This fact hides the other issue with this function that the opened process handle is only closed in this code path when it should be closed outside the if.

Furthermore, the result of OpenProcess should be evaluated as it might be NULL.

Nothing breaking, just caused some confusion on our side as we took this function as an example on how to wait for the web view process to finish before doing some clean up on our side.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SampleApps/WebView2APISample/ProcessComponent.cpp around line 554 and inspect EnsureProcessIsClosed, including the adjacent OpenProcess call and WaitForSingleObject usage. Confirm the process handle requests the required rights, OpenProcess failure is handled, and the handle is closed on every path; validate the behavior by building and exercising the sample's process-cleanup flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.