summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-06-22 15:10:59 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-22 14:21:29 +0000
commitd439739e15c100f257a1a1842770c4282dc9666e (patch)
treecf8b1ae4b27e92b58b18304ebe759e0158cd16c2
parent4ff5df3635ef173de5acb42528ff9e7c13117e62 (diff)
downloadqtsvg-d439739e15c100f257a1a1842770c4282dc9666e.tar.gz
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) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/svg/qsvgtinydocument.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp
index b4b9526..9e5da82 100644
--- a/src/svg/qsvgtinydocument.cpp
+++ b/src/svg/qsvgtinydocument.cpp
@@ -408,11 +408,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());
@@ -422,10 +422,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()) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
if (m_implicitViewBox || !preserveAspectRatio()) {
// Code path used when no view box is set, or IgnoreAspectRatio requested