Skip to content

Fix a bug where add_plugin uses a pointer to a freed string's data. - #443

Open
mardigontoler wants to merge 1 commit into
utopia-rise:masterfrom
mardigontoler:fix_add_plugin_use_after_free
Open

Fix a bug where add_plugin uses a pointer to a freed string's data.#443
mardigontoler wants to merge 1 commit into
utopia-rise:masterfrom
mardigontoler:fix_add_plugin_use_after_free

Conversation

@mardigontoler

@mardigontoler mardigontoler commented Aug 15, 2026

Copy link
Copy Markdown

This extension was failing to load plugins on macos. I found that in add_plugin, the result of p_plugin_path.utf8().get_data() was being stored in a variable. However, because .utf8 allocates a new string for itself but was only being used a temporary value, it's de-allocated at the end of that expression, and the resulting pointer is dangling.

This PR stores the CharString returned from .utf8() as a local variable, so the memory is still valid when we use the result of get_data().

@mardigontoler mardigontoler changed the title Fix a bug where add_plugin uses a pointer to a freed string data. Fix a bug where add_plugin uses a pointer to a freed string's data. Aug 15, 2026
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.

1 participant