gnome-system-monitor r2370 - branches/gnome-2-22/src
- From: bdejean svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-system-monitor r2370 - branches/gnome-2-22/src
- Date: Sat, 29 Mar 2008 19:10:19 +0000 (GMT)
Author: bdejean
Date: Sat Mar 29 19:10:19 2008
New Revision: 2370
URL: http://svn.gnome.org/viewvc/gnome-system-monitor?rev=2370&view=rev
Log:
Don't crash on invalid user input (regex syntax error).
See #524162.
Modified:
branches/gnome-2-22/src/lsof.cpp
Modified: branches/gnome-2-22/src/lsof.cpp
==============================================================================
--- branches/gnome-2-22/src/lsof.cpp (original)
+++ branches/gnome-2-22/src/lsof.cpp Sat Mar 29 19:10:19 2008
@@ -138,28 +138,35 @@
this->clear_results();
- Lsof lsof(this->pattern(), this->case_insensitive);
- // lsof = new SimpleLsof(this->pattern(), this->case_insensitive);
unsigned count = 0;
- for (ProcInfo::Iterator it(ProcInfo::begin()); it != ProcInfo::end(); ++it) {
- const ProcInfo &info(*it->second);
+ try {
+ Lsof lsof(this->pattern(), this->case_insensitive);
- MatchSet matches;
- lsof.search(info, std::inserter(matches, matches.begin()));
- count += matches.size();
-
- for (iterator it(matches.begin()), end(matches.end()); it != end; ++it) {
- GtkTreeIter file;
- gtk_list_store_append(this->model, &file);
- gtk_list_store_set(this->model, &file,
- PROCMAN_LSOF_COL_PIXBUF, info.pixbuf->gobj(),
- PROCMAN_LSOF_COL_PROCESS, info.name,
- PROCMAN_LSOF_COL_PID, info.pid,
- PROCMAN_LSOF_COL_FILENAME, it->c_str(),
- -1);
+ for (ProcInfo::Iterator it(ProcInfo::begin()); it != ProcInfo::end(); ++it) {
+ const ProcInfo &info(*it->second);
+
+ MatchSet matches;
+ lsof.search(info, std::inserter(matches, matches.begin()));
+ count += matches.size();
+
+ for (iterator it(matches.begin()), end(matches.end()); it != end; ++it) {
+ GtkTreeIter file;
+ gtk_list_store_append(this->model, &file);
+ gtk_list_store_set(this->model, &file,
+ PROCMAN_LSOF_COL_PIXBUF, info.pixbuf->gobj(),
+ PROCMAN_LSOF_COL_PROCESS, info.name,
+ PROCMAN_LSOF_COL_PID, info.pid,
+ PROCMAN_LSOF_COL_FILENAME, it->c_str(),
+ -1);
+ }
}
}
+ catch (Glib::RegexError& error) {
+ procman_debug("Regex error with pattern '%s' : %s",
+ this->pattern().c_str(),
+ error.what().c_str());
+ }
this->update_count(count);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]