diff options
author | Simon Hausmann <[email protected]> | 2014-04-29 14:45:13 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-05-21 16:20:35 +0200 |
commit | 932ebc4e7c2a67538a36e311c32e00d434de189e (patch) | |
tree | e8ee350c2d79ebff80cb8cfdf941af690edbcd94 /src/qml/jsruntime/qv4functionobject.cpp | |
parent | 358436f32a4e35091e8b56e32cf639b303665426 (diff) |
Fix failing assertion inside MSVC STL in debug builds
When using FunctionObject's call() method, we use std::copy to copy the
arguments over to the new call context. Unfortunately std::copy has an
assertion in there to check that we're not copying out of bounds. What the STL
doesn't know is that the Value args[1] array is dynamically allocated and
easily expands beyond just one entry.
Fall back to copying by hand to work around this issue.
Task-number: QTBUG-38195
Change-Id: I6e254b1c893ccf5cad2358179cda1b07b00228e0
Reviewed-by: Friedemann Kleint <[email protected]>
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 8e943fa6ef..39a123c4d2 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -326,8 +326,8 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx) ScopedCallData callData(scope, ctx->callData->argc ? ctx->callData->argc - 1 : 0); if (ctx->callData->argc) { - std::copy(ctx->callData->args + 1, - ctx->callData->args + ctx->callData->argc, callData->args); + for (int i = 1; i < ctx->callData->argc; ++i) + callData->args[i - 1] = ctx->callData->args[i]; } callData->thisObject = ctx->argument(0); return o->call(callData); |