aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexpobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-08 11:00:22 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-11 13:11:30 +0000
commit04b4a269e604731f855b8008acc94dcd70ea116c (patch)
tree1abc4f5067736704656a10f4c08e4933fcc3af72 /src/qml/jsruntime/qv4regexpobject.cpp
parentd6d659a04832217d05930063a2aa484a5f0ec7ee (diff)
Enable the Yarr JIT for regexps with nested parenthesis
Change-Id: I4e7a44ae2b5759febec6f83ab9fa85612515ab04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index f8caf404e9..414ce8e78c 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -391,9 +391,12 @@ ReturnedValue RegExpPrototype::method_exec(const FunctionObject *b, const Value
int len = r->value()->captureCount();
array->arrayReserve(len);
ScopedValue v(scope);
+ int strlen = str->d()->length();
for (int i = 0; i < len; ++i) {
int start = matchOffsets[i * 2];
int end = matchOffsets[i * 2 + 1];
+ if (end > strlen)
+ end = strlen;
v = (start != -1) ? scope.engine->memoryManager->alloc<ComplexString>(str->d(), start, end - start)->asReturnedValue() : Encode::undefined();
array->arrayPut(i, v);
}