From 19b87999580d596a3b14e38f44309f16307bfe0e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 15 Oct 2018 08:36:17 +0200 Subject: Fix a crash when allocating huge memory segments When allocating a huge item that requires it's own memory segment, we were actually not committing enough memory from the OS. Fixes: QTBUG-71501 Change-Id: Ic86a648bba4d7f1eeeded78d8de0f0fc1d3a251d Reviewed-by: Ulf Hermann --- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 8f388fcac6..2f110ed5a5 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -359,6 +359,7 @@ private slots: void temporaryDeadZone(); void importLexicalVariables_data(); void importLexicalVariables(); + void hugeObject(); private: // static void propertyVarWeakRefCallback(v8::Persistent object, void* parameter); @@ -8846,6 +8847,17 @@ void tst_qqmlecmascript::importLexicalVariables() QCOMPARE(result, QVariant(expected)); } +void tst_qqmlecmascript::hugeObject() +{ + // mainly check that this doesn't crash + QJSEngine engine; + QJSValue v = engine.evaluate(QString::fromLatin1( + "var known = {}, prefix = 'x'\n" + "for (var i = 0; i < 150000; i++) known[prefix + i] = true;" + )); + QVERIFY(!v.isError()); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" -- cgit v1.2.3