SkScaledBitmapSampler: fix memory overwritten

Cherry-picked from
in Skia.

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]
 (X < height)
 && ((X - sampleSize/2) % sampleSize == 0)
 && ((X - sampleSize/2)/sampleSize >= height/sampleSize)

Signed-off-by: Lu Tong <>


Review URL:

Change-Id: I2cca83a2a5c39b5a497f36b40724262b438ead8b
1 file changed