summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chromium/base/metrics/sample_vector.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/chromium/base/metrics/sample_vector.cc b/chromium/base/metrics/sample_vector.cc
index ce1ea737abd..87c78096253 100644
--- a/chromium/base/metrics/sample_vector.cc
+++ b/chromium/base/metrics/sample_vector.cc
@@ -266,6 +266,12 @@ void SampleVectorBase::MoveSingleSampleToCounts() {
if (sample.count == 0)
return;
+ // Stop here if the sample bucket would be out of range for the AtomicCount
+ // array.
+ if (sample.bucket >= counts_size()) {
+ return;
+ }
+
// Move the value into storage. Sum and redundant-count already account
// for this entry so no need to call IncreaseSumAndCount().
subtle::NoBarrier_AtomicIncrement(&counts()[sample.bucket], sample.count);