MicrosoftEdge / MicrosoftEdge/WebView2Feedback
ICoreWebView2WebResourceRequest get_Content passes back a stream object with invalid pointer to Read method
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Description
Our Win32 app uses WebView2 to display some web pages and inspect the GET and POST requests sent while the page is loading etc. In our Invoke function we attempt to read the POST request data, like this:
HRESULT STDMETHODCALLTYPE
Invoke (ICoreWebView2* webview, ICoreWebView2WebResourceRequestedEventArgs* args)
{
ICoreWebView2WebResourceRequest* req;
IStream* strm;
HRESULT hr;
hr = args->get_Request(&req);
if (SUCCEEDED(hr)) {
hr = req->get_Content(&strm);
if (SUCCEEDED(hr)) {
char *data = (char *)HeapAlloc(GetProcessHeap(), 0, 32768);
if (data != NULL) {
DWORD actcount = 0;
hr = strm->Read(data, 32768, &actcount);
if (hr == S_OK || hr == S_FALSE) {
/* do stuff with data */
}
HeapFree(GetProcessHeap(), 0, data);
}
}
}
return(S_OK);
}
the code above will in some cases fail when calling strm->Read(...) with the following:
Exception thrown: read access violation.
ISequentialStream::Read[virtual] was 0xFFFFFFFFFFFFFFFF.
OR
Exception thrown: read access violation.
strm->lpVtbl+1->QueryInterface was 0xFFFFFFFFFFFFFFFF.
Version
SDK: Windows 10 SDK 10.0.20348.0
Runtime: Microsoft.Web.WebView2 1.0.1054.31 and 1.0.1150.38
Framework: Win32
OS: Windows Server 2019 (17763.2686)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Win32 Invoke example in the issue and reproduce the failure at IStream::Read after ICoreWebView2WebResourceRequest::get_Content. Compare behavior across the listed WebView2 SDK and runtime versions, and inspect whether the returned stream pointer remains valid. Done means identifying a reliable cause and documenting or resolving the invalid pointer behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100