diff --git a/mfbt/RollingMean.h b/mfbt/RollingMean.h index 5add14c879f..8cc3148e960 100644 --- a/mfbt/RollingMean.h +++ b/mfbt/RollingMean.h @@ -86,7 +86,7 @@ public: T mean() { MOZ_ASSERT(!empty()); - return T(mTotal / mValues.length()); + return T(mTotal / int64_t(mValues.length())); } bool empty() diff --git a/xpcom/ds/TimeStamp.h b/xpcom/ds/TimeStamp.h index fdb87559d60..036ef578c30 100644 --- a/xpcom/ds/TimeStamp.h +++ b/xpcom/ds/TimeStamp.h @@ -181,6 +181,11 @@ private: // If required, use MultDouble explicitly and with care. BaseTimeDuration operator*(const double aMultiplier) const = delete; + // Block double divisor (for the same reason, and because dividing by + // fractional values would otherwise invoke the int64_t variant, and rounding + // the passed argument can then cause divide-by-zero) - Bug 1147491. + BaseTimeDuration operator/(const double aDivisor) const = delete; + public: BaseTimeDuration MultDouble(double aMultiplier) const {