diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-04-15 12:03:49 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-15 16:14:19 (GMT) |
commit | 2419f501558d1ca457c06e9225bde5d0502d8a02 (patch) | |
tree | 223e3f2f832e031ca17bbdd9dfb3e935a4054883 /src/gui/painting | |
parent | 49122ec5f25f2ffdf61908c0e4bb1a7ff42ee2b9 (diff) | |
download | Qt-2419f501558d1ca457c06e9225bde5d0502d8a02.zip Qt-2419f501558d1ca457c06e9225bde5d0502d8a02.tar.gz Qt-2419f501558d1ca457c06e9225bde5d0502d8a02.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')
-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; |