Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dangling pointers around WinVerifyTrust #3176

Merged
merged 2 commits into from
Dec 21, 2023
Merged

Fix dangling pointers around WinVerifyTrust #3176

merged 2 commits into from
Dec 21, 2023

Conversation

myles-keough
Copy link
Contributor

This addresses the crash related to #2574. The underlying issue is the lack of references to go-managed objects due to unsafe unsafe.Pointer usage, allowing them to be garbage collected before use in WinVerifyTrust.

Alternative approaches to this could be using an unmanaged buffer or runtime.Pinner (requires go 1.21).

Garbage collection on necessary object example (ci, fi, filename, etc.)
https://go.dev/play/p/pAOR_bE7wh9

@CLAassistant
Copy link

CLAassistant commented Dec 20, 2023

CLA assistant check
All committers have signed the CLA.

@scudette scudette merged commit 096ddd7 into Velocidex:master Dec 21, 2023
3 checks passed
scudette added a commit that referenced this pull request Dec 26, 2023
This addresses the crash related to
#2574. The underlying
issue is the lack of references to go-managed objects due to unsafe
unsafe.Pointer usage, allowing them to be garbage collected before use
in `WinVerifyTrust`.

Alternative approaches to this could be using an unmanaged buffer or
`runtime.Pinner` (requires go 1.21).

Garbage collection on necessary object example (ci, fi, filename, etc.)
https://go.dev/play/p/pAOR_bE7wh9

---------

Co-authored-by: Mike Cohen <mike@velocidex.com>
scudette added a commit that referenced this pull request Dec 26, 2023
This addresses the crash related to
#2574. The underlying
issue is the lack of references to go-managed objects due to unsafe
unsafe.Pointer usage, allowing them to be garbage collected before use
in `WinVerifyTrust`.

Alternative approaches to this could be using an unmanaged buffer or
`runtime.Pinner` (requires go 1.21).

Garbage collection on necessary object example (ci, fi, filename, etc.)
https://go.dev/play/p/pAOR_bE7wh9

---------

Co-authored-by: Mike Cohen <mike@velocidex.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants