diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-17 14:54:56 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-08-18 12:30:11 +0200 |
commit | ca2b4d1ccabc3bccde4d146284b1cac39058e711 (patch) | |
tree | a1212508a9ba63935801254a278ade73ff0ac819 /src/qml/jsruntime/qv4function.cpp | |
parent | 45dacdaa788eeac64148465658b6af2d2fa552cf (diff) |
Fix invalid reads with strings
It may happen that a dynamically created compilation unit disappears before any
QV4::Strings it created. Those strings would still have a reference to the
QString data in the compilation unit. I don't see a choice other than making a
copy of the string data ;(. But this patch adds a flag that would allow for
avoiding it if we happen to know that the compilation unit data is static.
Change-Id: Ib35a4d2a566b301a25ffe56e392809e44e7b4ae8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4function.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4function.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index 607d06756d..e989d31c1b 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -72,13 +72,13 @@ Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, formals.resize(compiledFunction->nFormals); const quint32 *formalsIndices = compiledFunction->formalsTable(); for (int i = 0; i < compiledFunction->nFormals; ++i) - formals[i] = engine->newString(unit->data->stringAt(formalsIndices[i])->qString()); + formals[i] = engine->newString(unit->data->stringAt(formalsIndices[i])); locals.resize(compiledFunction->nLocals); const quint32 *localsIndices = compiledFunction->localsTable(); for (int i = 0; i < compiledFunction->nLocals; ++i) - locals[i] = engine->newString(unit->data->stringAt(localsIndices[i])->qString()); + locals[i] = engine->newString(unit->data->stringAt(localsIndices[i])); } Function::~Function() |