From 05a3eac35c58295caf5937da42c32da540b05cb0 Mon Sep 17 00:00:00 2001 From: cblume Date: Mon, 19 Sep 2016 21:05:18 -0700 Subject: 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 --- src/image/SkImage_Gpu.cpp | 10 +++++----- 1 file 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(buffer); - intptr_t pixelsAsInt = bufferAsInt + pixelOffset; + uintptr_t bufferAsInt = reinterpret_cast(buffer); + uintptr_t pixelsAsInt = bufferAsInt + pixelOffset; void* pixels = reinterpret_cast(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::value, -- cgit v1.2.3