Avoid out of bounds memory reads when scaling images
authorLars Knoll <lars.knoll@digia.com>
Tue, 25 Mar 2014 14:04:22 +0000 (15:04 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 28 Mar 2014 21:52:19 +0000 (22:52 +0100)
commitc4d8734c504cf0f313245befa34501e7314b4cd1
treefe7c21c9e75b2cfbb3d4c95eb04ccf56bae38ce7
parent123ae472e2668a1f57f7c69a1a2a59336f83d06a
Avoid out of bounds memory reads when scaling images

The calculation of the width/height required for the
scaling algorithm was prone to floating point rounding
issues, where the lower value got rounded down, the higher
one rounded up. This could lead to a situation where we
iterated over one more line/pixel in the line than we have
in the source image.

Correct this by passing the dimension of the source image into
the function and bounds checking the values before iterating.

Task-number: QTBUG-35927
Change-Id: If44b2235a479224660d508a0504fec40d724763a
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
src/gui/painting/qblendfunctions.cpp
src/gui/painting/qblendfunctions_p.h
src/gui/painting/qdrawhelper.cpp
src/gui/painting/qdrawhelper_neon.cpp
src/gui/painting/qdrawhelper_p.h
src/gui/painting/qdrawhelper_sse2.cpp
src/gui/painting/qpaintengine_raster.cpp
tests/auto/gui/image/qimage/tst_qimage.cpp