diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 14:09:51 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-29 23:18:07 +0000 |
commit | 384fc28b908c23dfbd1a955945f17178bba96ff4 (patch) | |
tree | 69abc6138c85545b7712d58175c8013f120429cf /src/gui/painting/qimagescale.cpp | |
parent | 825e1a05062aa6b0c98c94b74d2f9b3e2fa6ff61 (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/painting/qimagescale.cpp')
-rw-r--r-- | src/gui/painting/qimagescale.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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++; } } |