Added a few more checks to avoid overflowing 32 bit sizes while computing convolutions.

I also changed a dangerously misleading INHERITED typedef.

BUG=389570
R=senorblanco@google.com, senorblanco@chromium.org

Author: sugoi@chromium.org

Review URL: https://codereview.chromium.org/361403006
This commit is contained in:
sugoi 2014-07-03 10:44:26 -07:00 коммит произвёл Commit bot
Родитель 2fe7b466c1
Коммит c197c8a47e
3 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -459,7 +459,7 @@ void BGRAConvolve2D(const unsigned char* sourceData,
}
// Compute where in the output image this row of final data will go.
unsigned char* curOutputRow = &output[outY * outputByteRowStride];
unsigned char* curOutputRow = &output[(uint64_t)outY * outputByteRowStride];
// Get the list of rows that the circular buffer has, in order.
int firstRowInCircularBuffer;

Просмотреть файл

@ -266,7 +266,8 @@ private:
bool SkScaledImageCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap,
SkColorTable* ctable) {
size_t size = bitmap->getSize();
if (0 == size) {
uint64_t size64 = bitmap->computeSize64();
if (0 == size || size64 > (uint64_t)size) {
return false;
}

Просмотреть файл

@ -450,6 +450,8 @@ public:
private:
GrGLUniformManager::UniformHandle fMatrixHandle;
GrGLUniformManager::UniformHandle fVectorHandle;
typedef GrGLEffect INHERITED;
};
private:
@ -462,7 +464,7 @@ private:
SkColorMatrix fMatrix;
typedef GrGLEffect INHERITED;
typedef GrEffect INHERITED;
};
GR_DEFINE_EFFECT_TEST(ColorMatrixEffect);