File 0002-Use-QRect-isEmpty-instead-of-QRect-isNull.patch of Package libqt5-qtsvg.21342

From 6f0058f66fdc297520a5ee0ed539d951897ff8b8 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@qt.io>
Date: Mon, 22 Jun 2020 15:10:59 +0200
Subject: [PATCH 02/21] Use QRect::isEmpty instead of QRect::isNull

Otherwise we can end up processing empty rects, and get divisions by
zero.

Fixes oss-fuzz issue 23633.

Change-Id: I0415462712792cb6a00eadd510b1688e859c419c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b5865df798323a63d8a89b8b50116888b930f3f0)
(cherry picked from commit 7479f2212e9280f887c11b41cb0907f1db3e0233)
---
 src/svg/qsvgtinydocument.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp
index da464cc..6889f7b 100644
--- a/src/svg/qsvgtinydocument.cpp
+++ b/src/svg/qsvgtinydocument.cpp
@@ -402,11 +402,11 @@ void QSvgTinyDocument::draw(QPainter *p, QSvgExtraStates &)
 void QSvgTinyDocument::mapSourceToTarget(QPainter *p, const QRectF &targetRect, const QRectF &sourceRect)
 {
     QRectF target = targetRect;
-    if (target.isNull()) {
+    if (target.isEmpty()) {
         QPaintDevice *dev = p->device();
         QRectF deviceRect(0, 0, dev->width(), dev->height());
-        if (deviceRect.isNull()) {
-            if (sourceRect.isNull())
+        if (deviceRect.isEmpty()) {
+            if (sourceRect.isEmpty())
                 target = QRectF(QPointF(0, 0), size());
             else
                 target = QRectF(QPointF(0, 0), sourceRect.size());
@@ -416,10 +416,10 @@ void QSvgTinyDocument::mapSourceToTarget(QPainter *p, const QRectF &targetRect,
     }
 
     QRectF source = sourceRect;
-    if (source.isNull())
+    if (source.isEmpty())
         source = viewBox();
 
-    if (source != target && !source.isNull()) {
+    if (source != target && !source.isEmpty()) {
         QTransform transform;
         transform.scale(target.width() / source.width(),
                   target.height() / source.height());
-- 
2.20.1

openSUSE Build Service is sponsored by