From c30a6232df03e1efbd9f3b226777b07e087a1122 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Oct 2020 14:27:29 +0200 Subject: BASELINE: Update Chromium to 85.0.4183.140 Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen --- chromium/base/numerics/checked_math_impl.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'chromium/base/numerics/checked_math_impl.h') diff --git a/chromium/base/numerics/checked_math_impl.h b/chromium/base/numerics/checked_math_impl.h index e083389ebf3..b6cc2966a6d 100644 --- a/chromium/base/numerics/checked_math_impl.h +++ b/chromium/base/numerics/checked_math_impl.h @@ -251,13 +251,23 @@ struct CheckedModOp::type; template static constexpr bool Do(T x, U y, V* result) { + if (BASE_NUMERICS_UNLIKELY(!y)) + return false; + using Promotion = typename BigEnoughPromotion::type; - if (BASE_NUMERICS_LIKELY(y)) { - Promotion presult = static_cast(x) % static_cast(y); - *result = static_cast(presult); - return IsValueInRangeForNumericType(presult); + if (BASE_NUMERICS_UNLIKELY( + (std::is_signed::value && std::is_signed::value && + IsTypeInRangeForNumericType::value && + static_cast(x) == + std::numeric_limits::lowest() && + y == static_cast(-1)))) { + *result = 0; + return true; } - return false; + + Promotion presult = static_cast(x) % static_cast(y); + *result = static_cast(presult); + return IsValueInRangeForNumericType(presult); } }; -- cgit v1.2.1