From 126a938fef232f9519499e255a974dbab8ba451b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 15 Jan 2016 13:29:32 -0500 Subject: breakpad: fix unittest failure when building with clang. In C/C++, the result of signed integer overflow is undefined. The expression "base + size - 1" is parsed as "(base + size) - 1", and "base + size" can overflow even if "base + (size - 1)" <= INT_MAX. See http://g/c-compiler-chrome/461JohPKakE/JI3rEBg6FwAJ for more. BUG=None TEST='CC=clang CXX=clang++ ./configure && make check' R=vapier@chromium.org Review URL: https://codereview.chromium.org/1591793002 . --- src/processor/range_map-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/processor/range_map-inl.h b/src/processor/range_map-inl.h index 55dae839..25604080 100644 --- a/src/processor/range_map-inl.h +++ b/src/processor/range_map-inl.h @@ -50,7 +50,7 @@ template bool RangeMap::StoreRange(const AddressType &base, const AddressType &size, const EntryType &entry) { - AddressType high = base + size - 1; + AddressType high = base + (size - 1); // Check for undersize or overflow. if (size <= 0 || high < base) { -- cgit v1.2.1