From 965878e88a9211b6995d57fddccf22ed365a9772 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 11 Nov 2013 11:22:24 +0100 Subject: Limit the amount of memory we allocate on the stack Setup limits for both the C and the JS stack, and check them before entering functions. If we run out of space, throw a RangeError exception. Be careful and recheck the stack bounds when things go outside. This catches the case where the engine got moved to another thread changing the stack boundaries. Windows currently uses an unsafe fallback implementation, this needs to be fixed later on. Task-number: QTBUG-34568 Change-Id: I22fbcbec57b28f9cc8a49e12f1cc6e53e4f07888 Reviewed-by: Erik Verbruggen Reviewed-by: Gunnar Sletta --- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto/qml/qqmlecmascript') diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 0f6d0b035d..52791cdee5 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -313,6 +313,7 @@ private slots: void singletonFromQMLToCpp(); void setPropertyOnInvalid(); void miscTypeTest(); + void stackLimits(); private: // static void propertyVarWeakRefCallback(v8::Persistent object, void* parameter); @@ -7404,7 +7405,12 @@ void tst_qqmlecmascript::miscTypeTest() QVERIFY(q.toBool() == true); delete object; +} +void tst_qqmlecmascript::stackLimits() +{ + QJSEngine engine; + engine.evaluate(QStringLiteral("function foo() {foo();} try {foo()} catch(e) { }")); } QTEST_MAIN(tst_qqmlecmascript) -- cgit v1.2.3