diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-04-15 12:03:49 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-04-15 12:42:51 (GMT) |
commit | 9da65ead69c92df717b1a63fe3c98c0cc73270f9 (patch) | |
tree | 20af4d308c650254a87713eac45126a56769bc10 /src/gui/painting/qwindowsurface.cpp | |
parent | 4e9c2364e8e9580aa317e9387338d45207ac4baa (diff) | |
download | Qt-9da65ead69c92df717b1a63fe3c98c0cc73270f9.zip Qt-9da65ead69c92df717b1a63fe3c98c0cc73270f9.tar.gz Qt-9da65ead69c92df717b1a63fe3c98c0cc73270f9.tar.bz2 |
Prevent crash in qt_scrollRectInImage.
Clip both against the source and target device rectangles.
Task-number: 247937
Reviewed-by: Trond
BT: yes
Diffstat (limited to 'src/gui/painting/qwindowsurface.cpp')
-rw-r--r-- | src/gui/painting/qwindowsurface.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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; |