diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-09-11 07:10:32 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-11-06 14:07:20 +0100 |
commit | 2753ebd6c6c320e459d2cab65e8a0328138c1d60 (patch) | |
tree | 3d39502955a66e562a61c93b212a531c345125bf /lib | |
parent | e00b3674f9fd8b606ea4d293dfb078ed4a621e12 (diff) | |
download | libquotient-2753ebd6c6c320e459d2cab65e8a0328138c1d60.tar.gz libquotient-2753ebd6c6c320e459d2cab65e8a0328138c1d60.zip |
util.cpp: assert validity of regular expressions
(cherry picked from commit 0e87640560343c15b0a218796509d2d94e1a5c77)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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); } |