From 384fc28b908c23dfbd1a955945f17178bba96ff4 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 28 Aug 2018 14:09:51 +0200 Subject: Fix out of buffer access in qt_qimageScaleRgba64_up_xy Avoid reading a pixel outside the image even if we multiply the result by 0. This mirrors a similar old fix in the the 32bit scaling path. Change-Id: I7860bc808dc46dbc94918672e99c81b56d4a1d27 Reviewed-by: Simon Hausmann --- src/gui/painting/qimagescale.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp index ca7930500e..96da5e029c 100644 --- a/src/gui/painting/qimagescale.cpp +++ b/src/gui/painting/qimagescale.cpp @@ -564,7 +564,10 @@ static void qt_qimageScaleRgba64_up_xy(QImageScaleInfo *isi, QRgba64 *dest, for (int x = 0; x < dw; x++) { const QRgba64 *pix = sptr + xpoints[x]; const int xap = xapoints[x]; - *dptr = interpolate256(pix[0], 256 - xap, pix[1], xap); + if (xap > 0) + *dptr = interpolate256(pix[0], 256 - xap, pix[1], xap); + else + *dptr = pix[0]; dptr++; } } -- cgit v1.2.3