aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4vme_moth.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-03-24 08:49:28 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-03-24 10:17:32 +0100
commite904f55b40424db770b5e1c2f311f88a8f996f25 (patch)
tree71bb685f5a73f28406f9c0a7e18008cc8df95351 /src/qml/jsruntime/qv4vme_moth.cpp
parentc2634e14273b77f8e4cb77585ab9d7eb7880bf34 (diff)
qv4vme_moth: Assert that sizeOf cannot be 0
This fixes CodeChecker warnings about alloca calls with 0; we know however that at this point the metatypes are valid, and thus necessarily have sizeof > 0. Change-Id: I2744374249d7b49459938389695a116484a292fc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4vme_moth.cpp')
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 47d7f277e6..c5be077f3a 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -457,6 +457,7 @@ void VME::exec(MetaTypesStackFrame *frame, ExecutionEngine *engine)
memcpy(transformedArguments, frame->argv(), frame->argc() * sizeof(void *));
}
+ Q_ASSERT(argumentType.sizeOf() > 0);
Q_ALLOCA_VAR(void, arg, argumentType.sizeOf());
argumentType.construct(arg);
if (frame->argc() > i)
@@ -468,10 +469,12 @@ void VME::exec(MetaTypesStackFrame *frame, ExecutionEngine *engine)
const QMetaType returnType = function->aotFunction->returnType;
Q_ALLOCA_DECLARE(void, transformedResult);
if (frame->returnValue()) {
- if (returnType == frame->returnType())
+ if (returnType == frame->returnType()) {
returnType.destruct(frame->returnValue());
- else
+ } else {
+ Q_ASSERT(returnType.sizeOf() > 0);
Q_ALLOCA_ASSIGN(void, transformedResult, returnType.sizeOf());
+ }
}
QQmlPrivate::AOTCompiledContext aotContext;