Revert "Fix comparison that overflows for addresses near uint max."

This reverts commit db8b8376b0.

Reason for revert: 

Assertion failure, see https://luci-milo.appspot.com/swarming/task/33e5ae4d2bb25210/steps/dm/0/stdout

Original change's description:
> Fix comparison that overflows for addresses near uint max.
> 
> BUG=chromium:683578
> 
> Change-Id: I3f9b79eeeba3c68cccb72bd6423811c8ff8f2067
> Reviewed-on: https://skia-review.googlesource.com/7410
> Commit-Queue: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@chromium.org>
> Reviewed-by: Mike Klein <mtklein@chromium.org>
> 

TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:683578

Change-Id: I198ea4c7209d060d0d15dfa3f6e555fa06e1a632
Reviewed-on: https://skia-review.googlesource.com/7415
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2017-01-23 19:59:26 +00:00 committed by Skia Commit-Bot
parent a9e8ef079b
commit 889176b3a3
2 changed files with 2 additions and 3 deletions

View File

@ -123,7 +123,7 @@ void SkArenaAlloc::ensureSpace(size_t size, size_t alignment) {
char* SkArenaAlloc::allocObject(size_t size, size_t alignment) {
size_t mask = alignment - 1;
char* objStart = (char*)((uintptr_t)(fCursor + mask) & ~mask);
if (size > (size_t)(fEnd - objStart)) {
if (objStart + size > fEnd) {
this->ensureSpace(size, alignment);
objStart = (char*)((uintptr_t)(fCursor + mask) & ~mask);
}
@ -142,7 +142,7 @@ restart:
char* objStart = (char*)((uintptr_t)(fCursor + skipOverhead + mask) & ~mask);
size_t totalSize = sizeIncludingFooter + skipOverhead;
if (totalSize > (size_t)(fEnd - objStart)) {
if (objStart + totalSize > fEnd) {
this->ensureSpace(totalSize, alignment);
goto restart;
}

View File

@ -68,7 +68,6 @@ public:
template <typename T, typename... Args>
T* make(Args&&... args) {
SkASSERT(SkTFitsIn<uint32_t>(sizeof(T)));
char* objStart;
if (skstd::is_trivially_destructible<T>::value) {
objStart = this->allocObject(sizeof(T), alignof(T));