From 848c5d01e2ed63f8d8b853db028da4484a1d2e2a Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 29 Jan 2014 10:07:34 +0100 Subject: [PATCH] Fixed assert in blend_transformed_tiled_argb px16 and py16 might be <0 in the first iteration of the loop. In order to avoid accessing an invalid index the values have to be corrected before px and py are accessed. Change-Id: I790faeacc2b77ae8af52bf5e69a2d801c9fe973d Reviewed-by: Andrew Knight Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 39193dd0938..813454fe8be 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5145,6 +5145,8 @@ static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *us int px_delta = fdx % (image_width << 16); int py_delta = fdy % (image_height << 16); while (b < end) { + if (px16 < 0) px16 += image_width << 16; + if (py16 < 0) py16 += image_height << 16; int px = px16 >> 16; int py = py16 >> 16; int y_offset = py * scanline_offset; @@ -5161,8 +5163,6 @@ static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *us py16 += py_delta; if (py16 >= image_height << 16) py16 -= image_height << 16; - if (px16 < 0) px16 += image_width << 16; - if (py16 < 0) py16 += image_height << 16; ++b; } func(target, buffer, l, coverage);