From 9da65ead69c92df717b1a63fe3c98c0cc73270f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 15 Apr 2009 14:03:49 +0200 Subject: Prevent crash in qt_scrollRectInImage. Clip both against the source and target device rectangles. Task-number: 247937 Reviewed-by: Trond BT: yes --- dist/changes-4.5.1 | 4 ++++ src/gui/painting/qwindowsurface.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.5.1 b/dist/changes-4.5.1 index 4fb155a..bda151f 100644 --- a/dist/changes-4.5.1 +++ b/dist/changes-4.5.1 @@ -162,6 +162,10 @@ Third party components sorting is disabled * [248163] Fixed possible crash in the paintEvent when spans are used. +- QWidget + * [250388] Fixed potential crash in QWidget::scroll() when using the raster + graphics system. + - QWizard * [248107] Fixed bug on Vista causing Back button to connect twice to the back() signal. diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index bcb0380..d941a24 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -310,10 +310,13 @@ void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) int lineskip = img.bytesPerLine(); int depth = img.depth() >> 3; - - const QRect r = rect & QRect(0, 0, img.width(), img.height()); + const QRect imageRect(0, 0, img.width(), img.height()); + const QRect r = rect & imageRect & imageRect.translated(-offset); const QPoint p = rect.topLeft() + offset; + if (r.isEmpty()) + return; + const uchar *src; uchar *dest; -- cgit v0.12