From f2262b10e23cc4f90838067bc658807ab8c8d3a8 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 4 Sep 2019 15:46:53 +0200 Subject: QQmlTypeLoader: Do some more sanity checks on file and path names Apparently we can end up with null bytes in those names, and those really should not be valid. Change-Id: I5b84dbc412342dbfb23befd5417a8bd394d4fb4f Reviewed-by: Fabian Kosmale Reviewed-by: Simon Hausmann --- src/qml/qml/qqmltypeloader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 3a18bbf7c9..42e7d2c4b4 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -964,8 +964,10 @@ QString QQmlTypeLoader::absoluteFilePath(const QString &path) bool QQmlTypeLoader::fileExists(const QString &path, const QString &file) { - if (path.isEmpty()) + const QChar nullChar(QChar::Null); + if (path.isEmpty() || path.contains(nullChar) || file.isEmpty() || file.contains(nullChar)) return false; + Q_ASSERT(path.endsWith(QLatin1Char('/'))); if (path.at(0) == QLatin1Char(':')) { // qrc resource -- cgit v1.2.3