Commit 18bd98e2 authored by Robert Roth's avatar Robert Roth

Fixed crash due to regex error (bgo#796168)

parent 37c31313
...@@ -214,6 +214,7 @@ iter_matches_search_key (GtkTreeModel *model, GtkTreeIter *iter, const gchar *se ...@@ -214,6 +214,7 @@ iter_matches_search_key (GtkTreeModel *model, GtkTreeIter *iter, const gchar *se
gboolean found; gboolean found;
char *search_pattern; char *search_pattern;
char **keys; char **keys;
Glib::RefPtr<Glib::Regex> regex;
gtk_tree_model_get (model, iter, gtk_tree_model_get (model, iter,
COL_NAME, &name, COL_NAME, &name,
...@@ -226,8 +227,11 @@ iter_matches_search_key (GtkTreeModel *model, GtkTreeIter *iter, const gchar *se ...@@ -226,8 +227,11 @@ iter_matches_search_key (GtkTreeModel *model, GtkTreeIter *iter, const gchar *se
keys = g_strsplit_set(search_text, " |", -1); keys = g_strsplit_set(search_text, " |", -1);
search_pattern = g_strjoinv ("|", keys); search_pattern = g_strjoinv ("|", keys);
try {
auto regex = Glib::Regex::create(search_pattern, Glib::REGEX_CASELESS); regex = Glib::Regex::create(search_pattern, Glib::REGEX_CASELESS);
} catch (const Glib::Error& ex) {
regex = Glib::Regex::create(Glib::Regex::escape_string(search_pattern), Glib::REGEX_CASELESS);
}
found = (name && regex->match(name)) || (user && regex->match(user)) found = (name && regex->match(name)) || (user && regex->match(user))
|| (pids && regex->match(pids)) || (args && regex->match(args)); || (pids && regex->match(pids)) || (args && regex->match(args));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment