Handle invalid argument count when updating a property
The WriteProperty path of InvokePacket handling did not validate the
number of arguments before calling RemoteObjectSourceBase::invoke(),
which was only validating the number of arguments via Q_ASSERT(), and
otherwise directly passing them to qt_metacall().
This leads to crashes and/or memory corruption, because the arguments
are stored in QVarLengthArray, so count mismatch will lead to reading
uninitialized elements of the array.
Fix it by checking that WriteProperty had exactly one argument, and
discarding a malformed packet with a warning.
The provided test sends a hand-crafted WriteProperty packet with zero
arguments. It was crashing without the fix.
Fixes: QTBUG-150775
Pick-to: 6.12 6.8 6.5 5.15
Change-Id: I020917c0a02e294f73faa96a1f580ca733d2b984
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>