bug 1218576 - Ensure Telemetry IDs coming from IPC are valid r=gfritzsche
☠☠ backed out by 1530103e032c ☠ ☠
authorChris H-C <chutten@mozilla.com>
Thu, 28 Jul 2016 12:22:06 -0400
changeset 313027 1b6666eb3b815fb289b8dc342f35fea47dffdb1b
parent 313026 ce2a2dabb0421fa8fd375f4baff9c9eac15cf723
child 313028 848f4ef30978ebbe1126012e0d1a29b59d8626ac
push id30669
push userkwierso@gmail.com
push dateThu, 08 Sep 2016 00:56:12 +0000
treeherdermozilla-central@77940cbf0c2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1218576
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1218576 - Ensure Telemetry IDs coming from IPC are valid r=gfritzsche I saw a one-off crash on try in internal_GetHistogramByEnumId. Not reproducible but maybe possible if we're trying to accumulate using an invalid ID. So let's guard against that. MozReview-Commit-ID: Ei6eTlV91mJ
toolkit/components/telemetry/TelemetryHistogram.cpp
--- a/toolkit/components/telemetry/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/TelemetryHistogram.cpp
@@ -2160,29 +2160,39 @@ void
 TelemetryHistogram::AccumulateChild(const nsTArray<Accumulation>& aAccumulations)
 {
   MOZ_ASSERT(XRE_IsParentProcess());
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
   if (!internal_CanRecordBase()) {
     return;
   }
   for (uint32_t i = 0; i < aAccumulations.Length(); ++i) {
+    bool isValid = internal_IsHistogramEnumId(aAccumulations[i].mId);
+    MOZ_ASSERT(isValid);
+    if (!isValid) {
+      continue;
+    }
     internal_AccumulateChild(aAccumulations[i].mId, aAccumulations[i].mSample);
   }
 }
 
 void
 TelemetryHistogram::AccumulateChildKeyed(const nsTArray<KeyedAccumulation>& aAccumulations)
 {
   MOZ_ASSERT(XRE_IsParentProcess());
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
   if (!internal_CanRecordBase()) {
     return;
   }
   for (uint32_t i = 0; i < aAccumulations.Length(); ++i) {
+    bool isValid = internal_IsHistogramEnumId(aAccumulations[i].mId);
+    MOZ_ASSERT(isValid);
+    if (!isValid) {
+      continue;
+    }
     internal_AccumulateChildKeyed(aAccumulations[i].mId,
                                   aAccumulations[i].mKey,
                                   aAccumulations[i].mSample);
   }
 }
 
 void
 TelemetryHistogram::ClearHistogram(mozilla::Telemetry::ID aId)