summaryrefslogtreecommitdiffstats
path: root/base/process_util_linux.cc
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 03:47:40 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 03:47:40 +0000
commit8e5bb9348dd921ccfb432082bdfed142dd27ebd7 (patch)
tree70f6f6e86931d0687258fd5eb1befda69b0ff082 /base/process_util_linux.cc
parent9327b63c271a72bdc4ae54b7d69836cb61742d5f (diff)
downloadchromium_src-8e5bb9348dd921ccfb432082bdfed142dd27ebd7.zip
chromium_src-8e5bb9348dd921ccfb432082bdfed142dd27ebd7.tar.gz
chromium_src-8e5bb9348dd921ccfb432082bdfed142dd27ebd7.tar.bz2
Linux: Better detect a race in /proc/pid/stats reading code.
BUG=145811 Review URL: https://chromiumcodereview.appspot.com/10916031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154367 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_linux.cc')
-rw-r--r--base/process_util_linux.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index 34e7d7c..393295a 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -68,6 +68,11 @@ bool ReadProcStats(pid_t pid, std::string* buffer) {
// Returns true if successful.
bool ParseProcStats(const std::string& stats_data,
std::vector<std::string>* proc_stats) {
+ // |stats_data| may be empty if the process disappeared somehow.
+ // e.g. http://crbug.com/145811
+ if (stats_data.empty())
+ return false;
+
// The stat file is formatted as:
// pid (process name) data1 data2 .... dataN
// Look for the closing paren by scanning backwards, to avoid being fooled by