diff --git a/base/metrics/persistent_histogram_allocator.cc b/base/metrics/persistent_histogram_allocator.cc index 403bb11ca0a02..cae7ea5073641 100644 --- a/base/metrics/persistent_histogram_allocator.cc +++ b/base/metrics/persistent_histogram_allocator.cc @@ -753,6 +753,15 @@ PersistentHistogramAllocator::GetOrCreateStatisticsRecorderHistogram( return nullptr; } + // DeserializeHistogramInfo() can return the static DummyHistogram singleton + // (e.g. when InspectConstructionArguments() rejects renderer-supplied + // parameters). The singleton lives in NoDestructor<> static storage and must + // never be passed to RegisterOrDeleteDuplicate(), which `delete`s + // already-registered objects. Treat it the same as a deserialization failure. + if (existing->GetHistogramType() == DUMMY_HISTOGRAM) { + return nullptr; + } + // Make sure there is no "serialization" flag set. DCHECK(!existing->HasFlags(HistogramBase::kIPCSerializationSourceFlag)); // Record the newly created histogram in the SR.