aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/designercore
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2020-06-11 19:10:39 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2020-06-11 17:12:50 +0000
commitce2342397ed2288a5787574bb9ad7771e58aec68 (patch)
treea12e6864a672305eda04d83dbb9f35dbb68371c1 /src/plugins/qmldesigner/designercore
parent04be31a7f3a15db9d5fb7a484b16e13ad55bec18 (diff)
QmlDesigner: Do not allow invalid annotations
Task-number: QDS-2269 Change-Id: Ib98cce353d7a92222013b0c2033a7524dddd5403 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner/designercore')
-rw-r--r--src/plugins/qmldesigner/designercore/model/rewriterview.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
index 4d8ebd4315..f0fd181e79 100644
--- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
@@ -53,6 +53,8 @@
#include <utils/changeset.h>
#include <utils/qtcassert.h>
+#include <QRegExp>
+
#include <utility>
#include <vector>
@@ -530,6 +532,9 @@ QString RewriterView::auxiliaryDataAsQML() const
QTC_ASSERT(!m_canonicalIntModelNode.isEmpty(), return {});
int columnCount = 0;
+
+ const QRegExp safeName("[a-z][a-zA-Z0-9]*");
+
for (const auto &node : allModelNodes()) {
QHash<PropertyName, QVariant> data = node.auxiliaryData();
if (!data.isEmpty()) {
@@ -562,6 +567,9 @@ QString RewriterView::auxiliaryDataAsQML() const
if (idIsQmlKeyWord(key))
continue;
+ if (!safeName.exactMatch(key))
+ continue;
+
const QVariant value = data.value(key.toUtf8());
QString strValue = value.toString();