aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-11-28 10:06:21 +0100
committerUlf Hermann <ulf.hermann@qt.io>2025-11-30 20:58:56 +0100
commitc094b60fedff5b2a52d0c350ecfa13fb5b9245b0 (patch)
tree5e737cb11c812bbde63c32ac4929cfa0995aa52f /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parentce63ad2d4e5596e6151ea08c2d42adb6a1aeb85a (diff)
QmlCompiler: Don't read out of bounds when analyzing splice()
You can call splice with only one argument, after all. Pick-to: 6.10 6.8 6.5 Fixes: QTBUG-142253 Change-Id: I3dec244325fd4d57a045ec024968e26e4f6372db Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index c968196693..08138e6a53 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -180,6 +180,7 @@ private slots:
void jsArrayMethods();
void jsArrayMethodsWithParams();
void jsArrayMethodsWithParams_data();
+ void jsArraySplice();
void jsImport();
void jsMathObject();
void jsmoduleImport();
@@ -3442,6 +3443,16 @@ void tst_QmlCppCodegen::jsArrayMethodsWithParams_data()
}
}
+void tst_QmlCppCodegen::jsArraySplice()
+{
+ QQmlEngine engine;
+ QQmlComponent splice(&engine, QUrl(u"qrc:/qt/qml/TestTypes/splice.qml"_s));
+ QVERIFY2(splice.isReady(), qPrintable(splice.errorString()));
+ QScopedPointer<QObject> spliceObject(splice.create());
+ QCOMPARE(spliceObject->property("intList").value<QList<int>>(), QList<int>({0, 1}));
+ QCOMPARE(spliceObject->property("spliced").value<QList<int>>(), QList<int>({2, 3}));
+}
+
void tst_QmlCppCodegen::jsImport()
{
QQmlEngine engine;