aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-09-11 07:10:32 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-09-11 07:10:32 +0200
commit0e87640560343c15b0a218796509d2d94e1a5c77 (patch)
tree245a0e7c21a4f780fa679ef9e47f76db08c8edf7 /lib
parent3c85f049389dec3b0ee6406f0be2cfaf0089f1fe (diff)
downloadlibquotient-0e87640560343c15b0a218796509d2d94e1a5c77.tar.gz
libquotient-0e87640560343c15b0a218796509d2d94e1a5c77.zip
util.cpp: assert validity of regular expressions
Diffstat (limited to 'lib')
-rw-r--r--lib/util.cpp3
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);
}