diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-09-04 15:46:53 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-09-05 16:03:58 +0200 |
commit | f2262b10e23cc4f90838067bc658807ab8c8d3a8 (patch) | |
tree | 385ba7a07de263c796468c68cdea9b52b3b4264c | |
parent | 53bece0812207e52b3368434c8174976b10e2aa8 (diff) |
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 <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt | 1 |
2 files changed, 3 insertions, 2 deletions
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 diff --git a/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt b/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt index 92ce4c649f..8dca84b34e 100644 --- a/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt +++ b/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt @@ -1,2 +1 @@ 5:1:TetZ$ is not a type --1:-1:Invalid QML type name "TetZ$" |