Fix a signedness issue with massive allocations, and also a truncation issue on

64-bit.

Review URL: http://codereview.appspot.com/2536044



git-svn-id: http://skia.googlecode.com/svn/trunk@606 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
scarybeasts@gmail.com 2010-10-18 22:56:49 +00:00
parent b70ae310bb
commit 6b9de8cb93

View File

@ -85,7 +85,9 @@ SkChunkAlloc::Block* SkChunkAlloc::newBlock(size_t bytes, AllocFailType ftype) {
return block;
}
size_t size = SkMax32((int32_t)bytes, (int32_t)fMinSize);
size_t size = bytes;
if (size < fMinSize)
size = fMinSize;
block = (Block*)sk_malloc_flags(sizeof(Block) + size,
ftype == kThrow_AllocFailType ? SK_MALLOC_THROW : 0);