diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-08-02 11:34:53 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-08-07 18:08:49 +0000 |
| commit | af1ef35fa00a466d3af04c17b59fcb4ea38f396a (patch) | |
| tree | 9738fb58bcb7c6171198d23df75cd830f9da4ab1 /src/qml/jsruntime/qv4engine.cpp | |
| parent | 5a8ac8f3d57c5381afb6a4d79990b0d7a5298936 (diff) | |
JSON: Properly handle bad objects in JSON.stringify()
For objects with circular structures we generate a proper error message
and fail earlier. For objects with excessive recursion we throw a range
error rather than crashing.
This behavior is modeled after node's behavior in such circumstances.
We use the existing stack overflow detection to determine when to throw
the range error. Testing shows that on windows the limit was
insufficient. Lower it.
Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-92192
Change-Id: I25dd302f65f359111e42492df3c71549c4ed7157
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 6ad8d2742b..c94b24b263 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -323,6 +323,9 @@ void ExecutionEngine::initializeStaticMembers() #elif defined(Q_OS_ANDROID) // In experiments, it started crashing at 1059. s_maxCallDepth = 1000; +#elif defined(Q_OS_WIN) + // We've seen crashes around 750. + s_maxCallDepth = 640; #else s_maxCallDepth = 1234; #endif |
