From 0752f9477e1beb6cfbcec608b60c6418cd3dccf4 Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Tue, 27 Sep 2022 21:58:24 +0200
Subject: [PATCH] Fix infinite loop that can be triggered by some invalid html

---
 src/Utils.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/Utils.cpp b/src/Utils.cpp
index d0b6818dc..cedf537ab 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -500,7 +500,11 @@ utils::escapeBlacklistedHtml(const QString &rawStr)
 
                     attrStart = consumeSpaces(attrEnd);
 
-                    if (attrStart < attrsEnd) {
+                    if (attrName.isEmpty()) {
+                        buffer.append(QUrl::toPercentEncoding(QString(QByteArray(attrStart, 1))));
+                        attrStart++;
+                        continue;
+                    } else if (attrStart < attrsEnd) {
                         if (*attrStart == '=') {
                             attrStart = consumeSpaces(attrStart + 1);
 
-- 
GitLab