Fix out-of-buffer read on image upscale
Avoid reading from the next pixel when the sample is fully based on the current pixel. This is particular important for the last pixel in an image when the next pixel might be outside the image buffer. Change-Id: I3607f9c6c332d11ff944ca35d216d417368f9fd5 Task-number: QTBUG-47228 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
parent
9fe0ff082c
commit
bec8c726bf
@ -312,7 +312,10 @@ static void qt_qimageScaleAARGBA_up_xy(QImageScaleInfo *isi, unsigned int *dest,
|
|||||||
for (int x = dxx; x < end; x++) {
|
for (int x = dxx; x < end; x++) {
|
||||||
const unsigned int *pix = sptr + xpoints[x];
|
const unsigned int *pix = sptr + xpoints[x];
|
||||||
const int xap = xapoints[x];
|
const int xap = xapoints[x];
|
||||||
|
if (xap > 0)
|
||||||
*dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap);
|
*dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap);
|
||||||
|
else
|
||||||
|
*dptr = pix[0];
|
||||||
dptr++;
|
dptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user