From 8985c2d1d4b297ea9fdc70e79e344bde73356216 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 0e193c43e..d6c701b0b 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -494,7 +494,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