diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-06-18 10:25:33 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-06-18 10:47:27 +0000 |
commit | 3eedf7598c322519c3a04374784bb2251e8982df (patch) | |
tree | ab3c309a9491db6e748b8ccfdaab1cc031c0d359 /src/lib/corelib/language/evaluatorscriptclass.cpp | |
parent | 1b1296d69791aa7a7e2b8f703c8a9ea1e42b54c8 (diff) |
Catch mis-use of "original" as default property value
This used to cause an infinite recursion, eventually crashing after
running out of stack space.
Change-Id: I073f7163d73a70b17bab078c8a99199bc9d21eaa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/language/evaluatorscriptclass.cpp')
-rw-r--r-- | src/lib/corelib/language/evaluatorscriptclass.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp index b7c2576df..18d7fd83f 100644 --- a/src/lib/corelib/language/evaluatorscriptclass.cpp +++ b/src/lib/corelib/language/evaluatorscriptclass.cpp @@ -177,6 +177,13 @@ private: QScriptValue originalValue; if (data->item->propertyDeclaration(propertyName->toString()).isScalar()) { const Item *item = itemOfProperty; + if (item->type() == ItemType::Module || item->type() == ItemType::Export) { + const QString errorMessage = Tr::tr("The special value 'original' cannot " + "be used on the right-hand side of a property declaration."); + extraScope = engine->currentContext()->throwError(errorMessage); + result.second = false; + return result; + } while (item->type() == ItemType::ModuleInstance) item = item->prototype(); if (item->type() != ItemType::Module && item->type() != ItemType::Export) { |