diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-11-11 11:22:24 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-18 11:05:25 +0100 |
commit | 965878e88a9211b6995d57fddccf22ed365a9772 (patch) | |
tree | 9a1420b21c307e263c6f5ee269d08c8f14fdcdec /tests | |
parent | a5d0ed01c8cbda9d6ec7e1a30b3f1266d3a277f8 (diff) |
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 <erik.verbruggen@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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<v8::Value> 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) |