Avoid out of bounds memory reads when scaling images v4.8.6
authorLars Knoll <lars.knoll@digia.com>
Tue, 25 Mar 2014 14:55:34 +0000 (15:55 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 3 Apr 2014 10:47:43 +0000 (12:47 +0200)
commit343df131f7207d65932c6505769aa2fb7fc04713
treeeb21e990c881d79f39a5bc85a5366df8190d5f7a
parent565f5236c6c72effa914ae0537a1fb2b0de1027c
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.

Backport of If44b2235a479224660d508a0504fec40d724763a from Qt 5

Task-number: QTBUG-35927
Change-Id: If145ee715a143b889538243f45227d8d78a0050f
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
src/gui/painting/qblendfunctions.cpp
src/gui/painting/qblendfunctions_p.h
src/gui/painting/qdrawhelper_neon.cpp
src/gui/painting/qdrawhelper_neon_p.h
src/gui/painting/qdrawhelper_p.h
src/gui/painting/qpaintengine_raster.cpp