SkScaledBitmapSampler: fix memory overwritten
Memory will be overwritten while downsampling some interlaced gif images, most commonly with odd sizes, when index of destination row stores in the current line computed from GifInterlaceIter meets: X is an integer in [0..height-1] and (X < height) && ((X - sampleSize/2) % sampleSize == 0) && ((X - sampleSize/2)/sampleSize >= height/sampleSize) Signed-off-by: Lu Tong <lu.x.tong@sonymobile.com> BUG=skia: Review URL: https://codereview.chromium.org/1085253002
This commit is contained in:
parent
72badbd99e
commit
9c798207b7
@ -762,7 +762,9 @@ bool SkScaledBitmapSampler::sampleInterlaced(const uint8_t* SK_RESTRICT src, int
|
||||
// of the destination bitmap's pixels, which is used to calculate the destination row
|
||||
// each time this function is called.
|
||||
const int dstY = srcYMinusY0 / fDY;
|
||||
SkASSERT(dstY < fScaledHeight);
|
||||
if (dstY >= fScaledHeight) {
|
||||
return false;
|
||||
}
|
||||
char* dstRow = fDstRow + dstY * fDstRowBytes;
|
||||
return fRowProc(dstRow, src + fX0 * fSrcPixelSize, fScaledWidth,
|
||||
fDX * fSrcPixelSize, dstY, fCTable);
|
||||
|
Loading…
Reference in New Issue
Block a user