aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar cblume <cblume@chromium.org>2016-09-19 21:05:18 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-19 21:05:18 -0700
commit05a3eac35c58295caf5937da42c32da540b05cb0 (patch)
tree023564e7babe5d9a8221431a0e48e5153e0114c1
parent4562f6ecda4dd819561e3eee17defd525017b3e1 (diff)
SkASSERT firing because pointer wraps negative.
Some pointers are being cast to intptr_t so they can be used with SkAlign8(). However, a large pointer value might become a negative integer since intptr_t is signed. When comparing these intptr_ts, we expect the larger pointer value to be greater. But it might be so large that it becomes negative, causing it to be less than. A SkASSERT is firing for this exact reason. BUG=648452 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2353453004 Review-Url: https://codereview.chromium.org/2353453004
-rw-r--r--src/image/SkImage_Gpu.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 55fb47a75d..f8e3b94aff 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -409,7 +409,7 @@ namespace {
class DTIBufferFiller
{
public:
- explicit DTIBufferFiller(intptr_t bufferAsInt)
+ explicit DTIBufferFiller(uintptr_t bufferAsInt)
: bufferAsInt_(bufferAsInt) {}
void fillMember(const void* source, size_t memberOffset, size_t size) {
@@ -418,7 +418,7 @@ public:
private:
- intptr_t bufferAsInt_;
+ uintptr_t bufferAsInt_;
};
}
@@ -552,8 +552,8 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
if (!fillMode) {
return size;
}
- intptr_t bufferAsInt = reinterpret_cast<intptr_t>(buffer);
- intptr_t pixelsAsInt = bufferAsInt + pixelOffset;
+ uintptr_t bufferAsInt = reinterpret_cast<uintptr_t>(buffer);
+ uintptr_t pixelsAsInt = bufferAsInt + pixelOffset;
void* pixels = reinterpret_cast<void*>(pixelsAsInt);
void* ct = nullptr;
if (ctSize) {
@@ -604,7 +604,7 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
}
// Fill in the mipmap levels if they exist
- intptr_t mipLevelPtr = pixelsAsInt + SkAlign8(pixmap.getSafeSize());
+ uintptr_t mipLevelPtr = pixelsAsInt + SkAlign8(pixmap.getSafeSize());
if (useMipMaps) {
static_assert(std::is_standard_layout<MipMapLevelData>::value,