Index: base/metrics/histogram_samples.cc |
diff --git a/base/metrics/histogram_samples.cc b/base/metrics/histogram_samples.cc |
index 4cd8e556b81c556dff9c2050348c47449c2d06c9..246a020495222be9806c90e36c153d378fe8d854 100644 |
--- a/base/metrics/histogram_samples.cc |
+++ b/base/metrics/histogram_samples.cc |
@@ -73,7 +73,11 @@ HistogramSamples::HistogramSamples(uint64_t id) |
HistogramSamples::HistogramSamples(uint64_t id, Metadata* meta) |
: meta_(meta) { |
DCHECK(meta_->id == 0 || meta_->id == id); |
- meta_->id = id; |
+ |
+ // It's possible that |meta| is contained in initialized, read-only memory |
+ // so it's essential that no write be done in that case. |
+ if (!meta_->id) |
+ meta_->id = id; |
} |
HistogramSamples::~HistogramSamples() {} |