From c1c2a46469b05805586af59596c9976104d33b31 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 25 May 2011 10:19:40 -0500 Subject: [PATCH] Fix use-after-free during incremental search --- ...after-free-during-incremental-search.patch | 38 ++++ gedit-2.13.2-filesel.patch | 172 ------------------ gedit-2.25.5-fix-python-path.patch | 23 --- gedit-gsettings-migration.patch | 64 ------- gedit.spec | 12 +- 5 files changed, 46 insertions(+), 263 deletions(-) create mode 100644 0001-Fix-use-after-free-during-incremental-search.patch delete mode 100644 gedit-2.13.2-filesel.patch delete mode 100644 gedit-2.25.5-fix-python-path.patch delete mode 100644 gedit-gsettings-migration.patch diff --git a/0001-Fix-use-after-free-during-incremental-search.patch b/0001-Fix-use-after-free-during-incremental-search.patch new file mode 100644 index 0000000..fc60845 --- /dev/null +++ b/0001-Fix-use-after-free-during-incremental-search.patch @@ -0,0 +1,38 @@ +From f8508ca201e7d16fa5e18a6130f456fdd3fc0c99 Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Wed, 25 May 2011 09:58:29 -0500 +Subject: [PATCH] Fix use-after-free during incremental search + +Move the free right before the assignment to ensure that +old_search_text is never left dangling and thus double-freed +if init_search_entry() is called again. + +Fixes https://bugzilla.gnome.org/show_bug.cgi?id=651068 +--- + gedit/gedit-view-frame.c | 3 +-- + 1 files changed, 1 insertions(+), 2 deletions(-) + +diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c +index 5826010..670b2b0 100644 +--- a/gedit/gedit-view-frame.c ++++ b/gedit/gedit-view-frame.c +@@ -1237,8 +1237,6 @@ init_search_entry (GeditViewFrame *frame) + guint old_find_flags = 0; + gint sel_len = 0; + +- g_free (frame->priv->old_search_text); +- + old_find_text = gedit_document_get_search_text (GEDIT_DOCUMENT (buffer), + &old_find_flags); + +@@ -1260,6 +1258,7 @@ init_search_entry (GeditViewFrame *frame) + } + else if (old_find_text != NULL) + { ++ g_free (frame->priv->old_search_text); + frame->priv->old_search_text = old_find_text; + add_search_completion_entry (old_find_text); + g_signal_handler_block (frame->priv->search_entry, +-- +1.7.5.1 + diff --git a/gedit-2.13.2-filesel.patch b/gedit-2.13.2-filesel.patch deleted file mode 100644 index 9d16bf3..0000000 --- a/gedit-2.13.2-filesel.patch +++ /dev/null @@ -1,172 +0,0 @@ ---- gedit-2.13.2/data/gedit.schemas.in.filesel 2006-01-13 13:27:15.000000000 -0500 -+++ gedit-2.13.2/data/gedit.schemas.in 2006-01-13 13:29:14.000000000 -0500 -@@ -629,5 +629,26 @@ - - - -+ -+ /schemas/apps/gedit-2/preferences/ui/open_save/selector_width -+ /apps/gedit-2/preferences/ui/open_save/selector_width -+ gedit -+ int + 400 -+ + Open/Save Dialog Width -+ Persistent Open/Save dialog width. -+ -+ -+ -+ -+ /schemas/apps/gedit-2/preferences/ui/open_save/selector_height -+ /apps/gedit-2/preferences/ui/open_save/selector_height -+ gedit -+ int -+ 400 -+ -+ Open/Save Dialog Height -+ Persistent Open/Save dialog height. -+ -+ - - ---- gedit-2.13.2/gedit/gedit-prefs-manager.h.filesel 2006-01-13 13:29:39.000000000 -0500 -+++ gedit-2.13.2/gedit/gedit-prefs-manager.h 2006-01-13 13:36:05.000000000 -0500 -@@ -106,6 +106,10 @@ - #define GPM_RECENTS_DIR GPM_PREFS_DIR "/ui/recents" - #define GPM_MAX_RECENTS GPM_RECENTS_DIR "/max_recents" - -+#define GPM_OPENSAVE_DIR GPM_PREFS_DIR "/ui/open_save" -+#define GPM_OPENSAVE_WIDTH GPM_OPENSAVE_DIR "/selector_width" -+#define GPM_OPENSAVE_HEIGHT GPM_OPENSAVE_DIR "/selector_height" -+ - /* Print */ - #define GPM_PRINT_PAGE_DIR GPM_PREFS_DIR "/print/page" - #define GPM_PRINT_SYNTAX GPM_PRINT_PAGE_DIR "/print_syntax_highlighting" -@@ -189,6 +193,9 @@ - - #define GPM_DEFAULT_MAX_RECENTS 5 - -+#define GPM_DEFAULT_OPENSAVE_WIDTH 400 -+#define GPM_DEFAULT_OPENSAVE_HEIGHT 400 -+ - #define GPM_DEFAULT_WINDOW_STATE 0 - #define GPM_DEFAULT_WINDOW_WIDTH 650 - #define GPM_DEFAULT_WINDOW_HEIGHT 500 -@@ -386,6 +393,15 @@ - */ - gint gedit_prefs_manager_get_max_recents (void); - -+/* Persistent size of open/save dialogs */ -+gint gedit_prefs_manager_get_opensave_dialog_width (void); -+void gedit_prefs_manager_set_opensave_dialog_width (gint width); -+gboolean gedit_prefs_manager_opensave_dialog_width_can_set (void); -+ -+gint gedit_prefs_manager_get_opensave_dialog_height (void); -+void gedit_prefs_manager_set_opensave_dialog_height (gint height); -+gboolean gedit_prefs_manager_opensave_dialog_height_can_set (void); -+ - /* Encodings */ - GSList *gedit_prefs_manager_get_auto_detected_encodings (void); - ---- gedit-2.13.2/gedit/gedit-prefs-manager.c.filesel 2006-01-13 13:42:22.000000000 -0500 -+++ gedit-2.13.2/gedit/gedit-prefs-manager.c 2006-01-13 13:42:56.000000000 -0500 -@@ -721,6 +721,16 @@ - - } - -+/* Open/Save dialog width */ -+DEFINE_INT_PREF (opensave_dialog_width, -+ GPM_OPENSAVE_WIDTH, -+ GPM_DEFAULT_OPENSAVE_WIDTH) -+ -+/* Open/Save dialog height */ -+DEFINE_INT_PREF (opensave_dialog_height, -+ GPM_OPENSAVE_HEIGHT, -+ GPM_DEFAULT_OPENSAVE_HEIGHT) -+ - /* Statusbar visiblity */ - DEFINE_BOOL_PREF (statusbar_visible, - GPM_STATUSBAR_VISIBLE, ---- gedit-2.13.2/gedit/gedit-commands-file.c.filesel 2006-01-13 13:36:19.000000000 -0500 -+++ gedit-2.13.2/gedit/gedit-commands-file.c 2006-01-13 13:42:11.000000000 -0500 -@@ -50,6 +50,7 @@ - #include "dialogs/gedit-close-confirmation-dialog.h" - #include "dialogs/gedit-open-location-dialog.h" - #include "gedit-file-chooser-dialog.h" -+#include "gedit-prefs-manager.h" - - - /* Defined constants */ -@@ -239,9 +240,15 @@ - { - GSList *uris; - const GeditEncoding *encoding; -+ gint selector_width; -+ gint selector_height; - - gedit_debug (DEBUG_COMMANDS); - -+ gtk_window_get_size (GTK_WINDOW (dialog), &selector_width, &selector_height); -+ gedit_prefs_manager_set_opensave_dialog_width (selector_width); -+ gedit_prefs_manager_set_opensave_dialog_height (selector_height); -+ - if (response_id != GTK_RESPONSE_OK) - { - gtk_widget_destroy (GTK_WIDGET (dialog)); -@@ -272,6 +279,8 @@ - gpointer data; - GeditDocument *doc; - gchar *default_path = NULL; -+ gint selector_width; -+ gint selector_height; - - gedit_debug (DEBUG_COMMANDS); - -@@ -336,6 +345,9 @@ - - g_free (default_path); - -+ selector_width = gedit_prefs_manager_get_opensave_dialog_width (); -+ selector_height = gedit_prefs_manager_get_opensave_dialog_height (); -+ gtk_window_resize (GTK_WINDOW (open_dialog), selector_width, selector_height); - g_signal_connect (open_dialog, - "response", - G_CALLBACK (open_dialog_response_cb), -@@ -585,6 +597,8 @@ - GeditTab *tab; - gpointer data; - GSList *tabs_to_save_as; -+ gint selector_width; -+ gint selector_height; - - gedit_debug (DEBUG_COMMANDS); - -@@ -603,6 +617,10 @@ - - encoding = gedit_file_chooser_dialog_get_encoding (dialog); - -+ gtk_window_get_size (GTK_WINDOW (dialog), &selector_width, &selector_height); -+ gedit_prefs_manager_set_opensave_dialog_width (selector_width); -+ gedit_prefs_manager_set_opensave_dialog_height (selector_height); -+ - gtk_widget_destroy (GTK_WIDGET (dialog)); - - if (tab != NULL) -@@ -701,6 +719,8 @@ - gchar *uri; - gboolean uri_set = FALSE; - const GeditEncoding *encoding; -+ gint selector_width; -+ gint selector_height; - - g_return_if_fail (GEDIT_IS_TAB (tab)); - g_return_if_fail (GEDIT_IS_WINDOW (window)); -@@ -778,6 +798,10 @@ - G_CALLBACK (save_dialog_response_cb), - window); - -+ selector_width = gedit_prefs_manager_get_opensave_dialog_width(); -+ selector_height = gedit_prefs_manager_get_opensave_dialog_height(); -+ gtk_window_resize (GTK_WINDOW (save_dialog), selector_width, selector_height); -+ - gtk_widget_show (save_dialog); - } - diff --git a/gedit-2.25.5-fix-python-path.patch b/gedit-2.25.5-fix-python-path.patch deleted file mode 100644 index 2274841..0000000 --- a/gedit-2.25.5-fix-python-path.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -urp gedit-2.29.3.orig/plugin-loaders/python/gedit-plugin-loader-python.c gedit-2.29.3/plugin-loaders/python/gedit-plugin-loader-python.c ---- gedit-2.29.3.orig/plugin-loaders/python/gedit-plugin-loader-python.c 2009-11-28 13:47:48.000000000 -0500 -+++ gedit-2.29.3/plugin-loaders/python/gedit-plugin-loader-python.c 2009-12-01 11:33:02.635871946 -0500 -@@ -486,7 +486,7 @@ gedit_python_init (GeditPluginLoaderPyth - PyObject *mdict, *tuple; - PyObject *gedit, *geditutils, *geditcommands, *geditplugins; - PyObject *gettext, *install, *gettext_args; -- char *argv[] = { "gedit", NULL }; -+ char *argv[] = { GEDIT_PLUGINS_LIBS_DIR, NULL }; - #ifdef HAVE_SIGACTION - gint res; - struct sigaction old_sigint; -diff -urp gedit-2.29.3.orig/plugin-loaders/python/Makefile.am gedit-2.29.3/plugin-loaders/python/Makefile.am ---- gedit-2.29.3.orig/plugin-loaders/python/Makefile.am 2009-09-20 13:43:50.000000000 -0400 -+++ gedit-2.29.3/plugin-loaders/python/Makefile.am 2009-12-01 11:33:44.012872511 -0500 -@@ -13,6 +13,7 @@ INCLUDES = \ - $(DISABLE_DEPRECATED_CFLAGS) \ - $(PYGTK_CFLAGS) \ - $(PYTHON_CFLAGS) \ -+ -DGEDIT_PLUGINS_LIBS_DIR=\"$(GEDIT_PLUGINS_LIBS_DIR)\" \ - -DGEDIT_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" - - loader_LTLIBRARIES = libpythonloader.la diff --git a/gedit-gsettings-migration.patch b/gedit-gsettings-migration.patch deleted file mode 100644 index b1e9b61..0000000 --- a/gedit-gsettings-migration.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -up gedit-2.31.5/data/gedit.convert.gsettings-migration gedit-2.31.5/data/gedit.convert ---- gedit-2.31.5/data/gedit.convert.gsettings-migration 2010-07-14 10:51:07.169956001 -0400 -+++ gedit-2.31.5/data/gedit.convert 2010-07-14 10:51:07.169956001 -0400 -@@ -0,0 +1,47 @@ -+[org.gnome.gedit.preferences.editor] -+use-default-font = /apps/gedit-2/preferences/editor/font/use_default_font -+editor-font = /apps/gedit-2/preferences/editor/font/editor_font -+scheme = /apps/gedit-2/preferences/editor/colors/scheme -+create-backup-copy = /apps/gedit-2/preferences/editor/save/create_backup_copy -+auto-save = /apps/gedit-2/preferences/editor/save/auto_save -+auto-save-interval = /apps/gedit-2/preferences/editor/save/auto_save_interval -+undo-actions-limit = /apps/gedit-2/preferences/editor/undo/undo_actions_limit -+max-undo-actions = /apps/gedit-2/preferences/editor/undo/max_undo_actions -+wrap-mode = /apps/gedit-2/preferences/editor/wrap_mode/wrap_mode -+tabs-size = /apps/gedit-2/preferences/editor/tabs/tabs_size -+insert-spaces = /apps/gedit-2/preferences/editor/tabs/insert_spaces -+auto-indent = /apps/gedit-2/preferences/editor/auto_indent/auto_indent -+display-line-numbers = /apps/gedit-2/preferences/editor/line_numbers/display_line_numbers -+highlight-current-line = /apps/gedit-2/preferences/editor/current_line/highlight_current_line -+bracket-matching = /apps/gedit-2/preferences/editor/bracket_matching/bracket_matching -+display-right-margin = /apps/gedit-2/preferences/editor/right_margin/display_right_margin -+right-margin-position = /apps/gedit-2/preferences/editor/right_margin/right_margin_position -+smart-home-end = /apps/gedit-2/preferences/editor/smart_home_end/smart_home_end -+writable-vfs-schemes = /apps/gedit-2/preferences/editor/save/writable_vfs_schemes -+restore-cursor-position = /apps/gedit-2/preferences/editor/cursor_position/restore_cursor_position -+syntax-highlighting = /apps/gedit-2/preferences/syntax_highlighting/enable -+search-highlighting = /apps/gedit-2/preferences/search_highlighting/enable -+ -+[org.gnome.gedit-preferences.ui] -+toolbar-visible = /apps/gedit-2/preferences/ui/toolbar/toolbar_visible -+toolbar-buttons-style = /apps/gedit-2/preferences/ui/toolbar/toolbar_buttons_style -+statusbar-visible = /apps/gedit-2/preferences/ui/statusbar/statusbar_visible -+side-pane-visible = /apps/gedit-2/preferences/ui/side_pane/side_pane_visible -+bottom-pane-visible = /apps/gedit-2/preferences/ui/bottom_panel/bottom_panel_visible -+max-recents = /apps/gedit-2/preferences/ui/recents/max_recents -+ -+[org.gnome.gedit.preferences.print] -+print-syntax-highlighting =/apps/gedit-2/preferences/print/page/print_syntax_highlighting -+print-header = /apps/gedit-2/preferences/print/page/print_header -+print-wrap-mode = /apps/gedit-2/preferences/print/page/print_wrap_mode -+#print-line-numbers = /apps/gedit-2/preferences/print/page/print_line_numbers -+print-font-body-pango = /apps/gedit-2/preferences/print/fonts/print_font_body_pango -+print-font-header-pango = /apps/gedit-2/preferences/print/fonts/print_font_header_pango -+print-font-numbers-pango = /apps/gedit-2/preferences/print/fonts/print_font_numbers_pango -+ -+[org.gnome.gedit.preferences.encodings] -+auto-detected = /apps/gedit-2/preferences/encodings/auto_detected -+shown-in-menu = /apps/gedit-2/preferences/encodings/shown_in_menu -+ -+[org.gnome.gedit.plugins] -+active-plugins = /apps/gedit-2/plugins/active-plugins -diff -up gedit-2.31.5/data/Makefile.am.gsettings-migration gedit-2.31.5/data/Makefile.am ---- gedit-2.31.5/data/Makefile.am.gsettings-migration 2010-07-06 06:33:40.000000000 -0400 -+++ gedit-2.31.5/data/Makefile.am 2010-07-14 10:52:46.159956002 -0400 -@@ -26,6 +26,9 @@ gsettings_SCHEMAS = org.gnome.gedit.gsch - - @GSETTINGS_RULES@ - -+convertdir = $(datadir)/GConf/gsettings -+convert_DATA = gedit.convert -+ - EXTRA_DIST = \ - $(desktop_in_files) \ - $(service_in_files) \ diff --git a/gedit.spec b/gedit.spec index bcc7b93..49101aa 100644 --- a/gedit.spec +++ b/gedit.spec @@ -11,7 +11,7 @@ Summary: Text editor for the GNOME desktop Name: gedit Epoch: 2 Version: 3.0.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ and GFDL Group: Applications/Editors #VCS: git:git://git.gnome.org/gedit @@ -22,9 +22,8 @@ URL: http://projects.gnome.org/gedit/ Requires(post): desktop-file-utils >= %{desktop_file_utils_version} Requires(postun): desktop-file-utils >= %{desktop_file_utils_version} -# Make the file selector remember last window size -# This patch needs to go upstream -#Patch0: gedit-2.13.2-filesel.patch +Patch0: 0001-Fix-use-after-free-during-incremental-search.patch + %ifarch ppc64,x86_64,ia64,s390x Patch1: gedit-2.13.90-libdir.patch %endif @@ -87,6 +86,8 @@ Install gedit-devel if you want to write plugins for gedit. %prep %setup -n gedit-%{version} -q +%patch0 -p1 -b .search-double-free + %ifarch ppc64,x86_64,ia64,s390x %patch1 -p1 -b .libdir %endif @@ -168,6 +169,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas %{_datadir}/gtk-doc %changelog +* Wed May 25 2011 Dan Williams 2:3.0.2-2 +- Fix double-free when searching + * Tue Apr 26 2011 Matthias Clasen 2:3.0.2-1 - Update to 3.0.2