Do not add Images with invalid geometry to the scene graph.
authorGunnar Sletta <gunnar.sletta@jollamobile.com>
Tue, 18 Feb 2014 17:47:03 +0000 (18:47 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 19 Feb 2014 19:13:47 +0000 (20:13 +0100)
Task-number: QTBUG-35656
Task-number: QTBUG-36050

Change-Id: Iea2d5303bdeb9c523e59ebcdc9f97288060be022
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
src/quick/items/qquickimage.cpp

index b6b8a2a..69a39d2 100644 (file)
@@ -676,6 +676,14 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
                   sourceRect.width() / d->pix.width(),
                   sourceRect.height() / d->pix.height());
 
+    if (targetRect.isEmpty()
+        || !qIsFinite(targetRect.width()) || !qIsFinite(targetRect.height())
+        || nsrect.isEmpty()
+        || !qIsFinite(nsrect.width()) || !qIsFinite(nsrect.height())) {
+        delete node;
+        return 0;
+    }
+
     if (d->pixmapChanged) {
         // force update the texture in the node to trigger reconstruction of
         // geometry and the likes when a atlas segment has changed.