5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 12:01:42 +08:00

[windows] Fix stack corruption when using ICoreWebView2HttpHeadersCollectionIterator (#1589)

The API expects a `BOOL *` with `typedef int BOOL` therefore
we need to use a `int32` on the stack.
This commit is contained in:
stffabi 2022-07-18 10:57:30 +02:00 committed by GitHub
parent af1c530442
commit 1247c8aa28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ func (i *ICoreWebView2HttpHeadersCollectionIterator) Release() error {
} }
func (i *ICoreWebView2HttpHeadersCollectionIterator) HasCurrentHeader() (bool, error) { func (i *ICoreWebView2HttpHeadersCollectionIterator) HasCurrentHeader() (bool, error) {
var hasHeader bool var hasHeader int32
res, _, err := i.vtbl.GetHasCurrentHeader.Call( res, _, err := i.vtbl.GetHasCurrentHeader.Call(
uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(i)),
uintptr(unsafe.Pointer(&hasHeader)), uintptr(unsafe.Pointer(&hasHeader)),
@ -34,7 +34,7 @@ func (i *ICoreWebView2HttpHeadersCollectionIterator) HasCurrentHeader() (bool, e
if windows.Handle(res) != windows.S_OK { if windows.Handle(res) != windows.S_OK {
return false, syscall.Errno(res) return false, syscall.Errno(res)
} }
return hasHeader, nil return hasHeader != 0, nil
} }
func (i *ICoreWebView2HttpHeadersCollectionIterator) GetCurrentHeader() (string, string, error) { func (i *ICoreWebView2HttpHeadersCollectionIterator) GetCurrentHeader() (string, string, error) {
@ -61,7 +61,7 @@ func (i *ICoreWebView2HttpHeadersCollectionIterator) GetCurrentHeader() (string,
} }
func (i *ICoreWebView2HttpHeadersCollectionIterator) MoveNext() (bool, error) { func (i *ICoreWebView2HttpHeadersCollectionIterator) MoveNext() (bool, error) {
var next bool var next int32
res, _, err := i.vtbl.MoveNext.Call( res, _, err := i.vtbl.MoveNext.Call(
uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(i)),
uintptr(unsafe.Pointer(&next)), uintptr(unsafe.Pointer(&next)),
@ -72,5 +72,5 @@ func (i *ICoreWebView2HttpHeadersCollectionIterator) MoveNext() (bool, error) {
if windows.Handle(res) != windows.S_OK { if windows.Handle(res) != windows.S_OK {
return false, syscall.Errno(res) return false, syscall.Errno(res)
} }
return next, nil return next != 0, nil
} }