diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-01-23 19:59:26 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-23 19:59:52 +0000 |
commit | 889176b3a3b5b71cc05c51dad3e7d2ddac610b7e (patch) | |
tree | 11c9d8148094c9107b40cf4541f3ff2497bd3c87 /src | |
parent | a9e8ef079bed014ef2b3f6951525cc662f649942 (diff) |
Revert "Fix comparison that overflows for addresses near uint max."
This reverts commit db8b8376b09cec9656b0ab864413b7911d81a84c.
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkArenaAlloc.cpp | 4 | ||||
-rw-r--r-- | src/core/SkArenaAlloc.h | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/core/SkArenaAlloc.cpp b/src/core/SkArenaAlloc.cpp index 39d1ed5fc8..5ac08dcdc3 100644 --- a/src/core/SkArenaAlloc.cpp +++ b/src/core/SkArenaAlloc.cpp @@ -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; } diff --git a/src/core/SkArenaAlloc.h b/src/core/SkArenaAlloc.h index 589f782b1e..532b45aa25 100644 --- a/src/core/SkArenaAlloc.h +++ b/src/core/SkArenaAlloc.h @@ -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)); |