Skip to content

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

Open
biglittlebigben wants to merge 3 commits intotinyzimmer:mainfrom
livekit:main
Open

Copy the return value using g_value_copy in goMarshal to avoid double free and invalid memory reads#9
biglittlebigben wants to merge 3 commits intotinyzimmer:mainfrom
livekit:main

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