aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2015-01-09 18:53:37 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-13 12:41:48 +0100
commit54123f5b69471eb6433b3530c379879318426904 (patch)
tree6d5134c78526b944e5e68872271f304a4629a906 /src/qml/jsruntime
parent6b808b1eee4956286995ad9b1c2e81ae4b1a5884 (diff)
Fix a harmless valgrind warning in RegExpObject
Only even values are initialized by the RegExp engine and the compiler might reorder end to be tested before start, which would let valgrind complain about branching on an uninitialized value. Fix the issue by only checking if start is offsetNoMatch since it is implied in the implementation that start == -1 => end == -1. This matches the behavior of RegExpMatchesArray::reifyAllProperties in WebKit Change-Id: Ifde1c5bc99da2a7929cd096bf477cae8799e4fed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 31dd6af2a7..4a843d8bdd 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -387,7 +387,7 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
for (int i = 0; i < len; ++i) {
int start = matchOffsets[i * 2];
int end = matchOffsets[i * 2 + 1];
- v = (start != -1 && end != -1) ? ctx->d()->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined();
+ v = (start != -1) ? ctx->d()->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined();
array->arrayPut(i, v);
}
array->setArrayLengthUnchecked(len);