Commit e5227ba5 authored by jkummerow's avatar jkummerow Committed by Commit bot

Update safe_math_impl.h

Porting Chromium's https://codereview.chromium.org/1142783002/ to fix a division-by-zero bug.

BUG=chromium:488302
LOG=n

Review URL: https://codereview.chromium.org/1135293003

Cr-Commit-Position: refs/heads/master@{#28475}
parent 66083dd0
......@@ -208,8 +208,8 @@ typename enable_if<std::numeric_limits<T>::is_integer &&
(sizeof(T) * 2 > sizeof(uintmax_t)),
T>::type
CheckedMul(T x, T y, RangeConstraint* validity) {
// if either side is zero then the result will be zero.
if (!(x || y)) {
// If either side is zero then the result will be zero.
if (!x || !y) {
return RANGE_VALID;
} else if (x > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment