summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4regexpobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-10-22 13:26:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-29 10:39:01 +0100
commitffcdbfa03f8bb36b521f8c1a703ee24085fe25bd (patch)
treeddee0370444a4f71cabb7847e7f1eb758622bd9f /src/qml/jsruntime/qv4regexpobject.cpp
parentaf22149dd8daf593182fec978f15dc1667c9cf8d (diff)
downloadqtdeclarative-ffcdbfa03f8bb36b521f8c1a703ee24085fe25bd.tar.gz
Protect write accesses to objects
Don't write to objects if we have a pending exception to avoid any side effects. Change-Id: I9f93a9195a652dbae7033cc6ebb355d5d86e9b5e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 8bcddcce0a..4f0f07377f 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -258,6 +258,8 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
QString pattern;
if (!r->isUndefined())
pattern = r->toString(ctx)->toQString();
+ if (scope.hasException())
+ return Encode::undefined();
bool global = false;
bool ignoreCase = false;
@@ -265,6 +267,8 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
if (!f->isUndefined()) {
f = __qmljs_to_string(f, ctx);
QString str = f->stringValue()->toQString();
+ if (scope.hasException())
+ return Encode::undefined();
for (int i = 0; i < str.length(); ++i) {
if (str.at(i) == QChar('g') && !global) {
global = true;