From 2753ebd6c6c320e459d2cab65e8a0328138c1d60 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 11 Sep 2020 07:10:32 +0200 Subject: util.cpp: assert validity of regular expressions (cherry picked from commit 0e87640560343c15b0a218796509d2d94e1a5c77) --- lib/util.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/util.cpp b/lib/util.cpp index 023645c1..ffb36068 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -60,6 +60,8 @@ void Quotient::linkifyUrls(QString& htmlEscapedText) QStringLiteral( R"((^|[^<>/])([!#@][-a-z0-9_=#/.]{1,252}:(?:\w|\.|-)+\.\w+(?::\d{1,5})?))"), RegExpOptions); + Q_ASSERT(FullUrlRegExp.isValid() && EmailAddressRegExp.isValid() + && MxIdRegExp.isValid()); // NOTE: htmlEscapedText is already HTML-escaped! No literal <,>,&," @@ -127,6 +129,7 @@ QString Quotient::serverPart(const QString& mxId) static QRegularExpression parser( re, QRegularExpression::UseUnicodePropertiesOption); // Because Asian digits + Q_ASSERT(parser.isValid()); return parser.match(mxId).captured(1); } -- cgit v1.2.3