diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-07-14 10:19:16 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-07-16 16:25:23 +0200 |
commit | c0f4442ae0d83e63fc90f1d5058081355f83b701 (patch) | |
tree | 49808334a7e6afb02b4a25259db4a3f1af02b83d /src/qml/qml/qqml.cpp | |
parent | f5ef090960f82f53318ca0fd15331bb7ef394366 (diff) |
Restrict qmlRegisterTypesAndRevisions to major version given
We should not register any revisions larger than the given major version
as that allows importing an incomplete module, as the version-less
import. Typically the offending version is pulled in via some
QML_FOREIGN and only the types derived from that foreign class are
available in the higher major version.
Change-Id: I186fb010d704bea514cefff9f66eb58186df5c91
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r-- | src/qml/qml/qqml.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp index 65fb6b0062..705017c6de 100644 --- a/src/qml/qml/qqml.cpp +++ b/src/qml/qml/qqml.cpp @@ -350,6 +350,8 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data) for (QTypeRevision revision : revisions) { if (revision < added) continue; + if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion()) + break; // When removed, we still add revisions, but anonymous ones if (removed.isValid() && !(revision < removed)) { @@ -397,6 +399,8 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data) for (QTypeRevision revision : qAsConst(revisions)) { if (revision < added) continue; + if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion()) + break; // When removed, we still add revisions, but anonymous ones if (removed.isValid() && !(revision < removed)) { |