Handle invalid format for a Registry packet


The name "Registry" is reserved by Qt Remote Objects for a special
Registry source. The protocol therefore expects a specific format of
a packet when a new client connects to the registry - the packet must
have one argument of the type QRemoteObjectSourceLocation.

However, nothing prevents the users from registering a custom object
under the name "Registry". An attempt to call a slot with no arguments
for such an object triggers a crash when trying to access the first
argument.
An alternative way to trigger the crash is to send a raw InvokePacket
command.

This patch fixes it by explicitly verifying the number of arguments
and checking that the first argument can be converted to the proper
type. The new unit-test was crashing without the fix.

Ideally it should be prohibited to register custom objects under the
name "Registry", but I cannot immediately tell if it can break any
valid usecase or not, so it is left for a follow-up patch.

Task-number: QTBUG-150775
Pick-to: 6.12 6.8 6.5 5.15
Change-Id: I5c54d4b19b57560f87dec6beb7deeabecbbe8c93
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
commitfa1430672264980222d1f771242e59a8a5da0dc3
parent63f2d354475b412b637a627416e29f540e4649dc
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeMon, 19 Oct 2026 08:45:34 +0000