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 .
This commit is contained in:
parent
081cbd64d7
commit
126a938fef
1 changed files with 1 additions and 1 deletions
|
@ -50,7 +50,7 @@ template<typename AddressType, typename EntryType>
|
|||
bool RangeMap<AddressType, EntryType>::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) {
|
||||
|
|
Loading…
Reference in a new issue