[geany/geany] 10f7cb: Avoid possible invalid memory access when activating plugin
Jiří Techet
git-noreply at xxxxx
Wed Nov 4 16:35:48 UTC 2015
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Wed, 04 Nov 2015 16:35:48 UTC
Commit: 10f7cb24b26d1a62cdf4851788e4363efacb1b78
https://github.com/geany/geany/commit/10f7cb24b26d1a62cdf4851788e4363efacb1b78
Log Message:
-----------
Avoid possible invalid memory access when activating plugin
It may happen (and happens on OS X) that plugin activation using
plugin_new() triggers some action which causes the tree view to
update. However, as the old plugin was freed before, the tree view
contains an invalid pointer to p which causes invalid memory access.
After freeing the old pointer, set the tree view value to NULL - the
plugin pointer is checked at other places for NULL value so it
doesn't crash.
Modified Paths:
--------------
src/plugins.c
Modified: src/plugins.c
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -1478,6 +1478,9 @@ static void pm_plugin_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer
/* save shortcuts (only need this group, but it doesn't take long) */
keybindings_write_to_file();
+ /* plugin_new() below may cause a tree view refresh with invalid p - set to NULL */
+ gtk_tree_store_set(pm_widgets.store, &store_iter,
+ PLUGIN_COLUMN_PLUGIN, NULL, -1);
plugin_free(p);
/* reload plugin module and initialize it if item is checked */
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list