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>
commit52979e1e26cb8fc636124944d46ab87c26882fd2
parentfa1430672264980222d1f771242e59a8a5da0dc3
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeMon, 19 Oct 2026 08:45:38 +0000