diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-28 04:15:43 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-28 04:15:43 +0000 |
commit | 59b15da7fe378b18a8788ead8fa6ea7cf9ac99e2 (patch) | |
tree | 7612e86091e74a4804899ac14a1c7780c09755c9 /base | |
parent | e01ca5ef9b041327793c3ad8d79caafa031df3c8 (diff) | |
download | chromium_src-59b15da7fe378b18a8788ead8fa6ea7cf9ac99e2.zip chromium_src-59b15da7fe378b18a8788ead8fa6ea7cf9ac99e2.tar.gz chromium_src-59b15da7fe378b18a8788ead8fa6ea7cf9ac99e2.tar.bz2 |
TrackedObjects - fix for checking signed int overflowing
which wasn't working due to compiler optimizations.
Fix for a crash in Canary on Mac.
R=jar@chromium.org
Review URL: https://chromiumcodereview.appspot.com/12378002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185150 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/tracked_objects.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index f5dc82d..b3bc975 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -74,7 +74,9 @@ DeathData::DeathData(int count) { void DeathData::RecordDeath(const int32 queue_duration, const int32 run_duration, int32 random_number) { - ++count_; + // We'll just clamp at INT_MAX, but we should note this in the UI as such. + if (count_ < INT_MAX) + ++count_; queue_duration_sum_ += queue_duration; run_duration_sum_ += run_duration; @@ -89,11 +91,7 @@ void DeathData::RecordDeath(const int32 queue_duration, // don't clamp count_... but that should be inconsequentially likely). // We ignore the fact that we correlated our selection of a sample to the run // and queue times (i.e., we used them to generate random_number). - if (count_ <= 0) { // Handle wrapping of count_, such as in bug 138961. - CHECK_GE(count_ - 1, 0); // Detect memory corruption. - // We'll just clamp at INT_MAX, but we should note this in the UI as such. - count_ = INT_MAX; - } + CHECK_GT(count_, 0); if (0 == (random_number % count_)) { queue_duration_sample_ = queue_duration; run_duration_sample_ = run_duration; |