Skip to content

Copy the return value using g_value_copy in goMarshal to avoid double free and invalid memory reads #9

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

biglittlebigben
Copy link

This is a PR that attempt to fix a double free and invalid memory access when registering a signal that returns a GValue. The Go signal marshaller currently does a shallow copy of the GValue (g) created from the native Go type into the returned GValue (retValue). If the GValue backs a type that requires deallocation (such as a string), this inner value payload will be deallocated twice, once when g gets deallocated, and once when retValue does. The PR suggests calling g_value_copy to do a deep copy of the GValue instead.

@biglittlebigben
Copy link
Author

Also added support for ParamSpec marshalling

@RSWilli
Copy link

RSWilli commented Aug 24, 2023

@biglittlebigben please move this PR to https://github.com/go-gst/go-glib (where future development of the bindings will take place) since it seems to fix a critical error

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