Limit the amount of memory we allocate on the stack
authorLars Knoll <lars.knoll@digia.com>
Mon, 11 Nov 2013 10:22:24 +0000 (11:22 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 18 Nov 2013 10:05:25 +0000 (11:05 +0100)
commit965878e88a9211b6995d57fddccf22ed365a9772
tree9a1420b21c307e263c6f5ee269d08c8f14fdcdec
parenta5d0ed01c8cbda9d6ec7e1a30b3f1266d3a277f8
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>
src/qml/jsruntime/qv4context.cpp
src/qml/jsruntime/qv4context_p.h
src/qml/jsruntime/qv4engine.cpp
src/qml/jsruntime/qv4engine_p.h
src/qml/jsruntime/qv4functionobject.cpp
src/qml/jsruntime/qv4script.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp