From e72b032cc1c5a8a07a99fc6522a692c36f369abc Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Mon, 6 Jan 2020 13:55:53 +0100 Subject: QV4MM: Fix crash caused by MarkStack overflow MemoryManager::collectFromJSStack did push to the mark stack without checking if there is actually still space available. To fix this, we now drain the stack once we hit the limit. The test case is a slightly modified version compared to the reported one, removing one loop. This was required as our regular expression does not throw an exception when there are too many capture groups. However, to trigger the bug, looping was not actually necessary. Change-Id: I4d00865f25a989c380f4f5b221f4068c80b71d2b Reviewed-by: Ulf Hermann --- src/qml/jsruntime/qv4value_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qml/jsruntime/qv4value_p.h') diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 4e901721cb..ae12033eb4 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -555,6 +555,8 @@ struct ValueArray { } else { while (v < end) { v->mark(markStack); + if (markStack->top >= markStack->limit) + markStack->drain(); ++v; } } -- cgit v1.2.3