qt6-qtsvg/qtsvg-fix-nullptr-dereference-with-invalid-svg.patch
2023-10-18 14:46:56 +02:00

27 lines
904 B
Diff

From effc44495a33babd4cf7a2044123f420e6b3da1c Mon Sep 17 00:00:00 2001
From: Paul Olav Tvete <paul.tvete@qt.io>
Date: Tue, 10 Oct 2023 10:14:22 +0200
Subject: [PATCH] Fix nullptr dereference with invalid SVG
Fixes: QTBUG-117944
Pick-to: 6.5 6.2
Change-Id: I9059dc28c750fc0585f1fb982152b211c323c6cd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit edc8ca7f1e45302223b4b7962a57a30918f84c8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
---
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 2649422..335500a 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -3606,6 +3606,8 @@
static bool detectCycles(const QSvgNode *node, QList<const QSvgUse *> active = {})
{
+ if (Q_UNLIKELY(!node))
+ return false;
switch (node->type()) {
case QSvgNode::DOC:
case QSvgNode::G: