[Tarantool-patches] [PATCH 2/2] box: fix uninitialized access to version_id in process_subscribe()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Aug 31 00:38:59 MSK 2021


Hi! Thanks for the patch!

> diff --git a/src/box/box.cc b/src/box/box.cc
> index 2c8113cbb..f98437d05 100644
> --- a/src/box/box.cc
> +++ b/src/box/box.cc
> @@ -2850,8 +2850,8 @@ box_process_subscribe(struct ev_io *io, struct xrow_header *header)
>  	struct tt_uuid replica_uuid = uuid_nil;
>  	struct tt_uuid peer_replicaset_uuid = uuid_nil;
>  	struct vclock replica_clock;
> -	uint32_t replica_version_id;
>  	vclock_create(&replica_clock);
> +	uint32_t replica_version_id = 0;

There seems to be an inconsistency in xrow_decode_subscribe(). It takes
multiple optional parameters, but only some of them are reset to default
values before the body is decoded.

- replicaset_uuid, instance_uuid, vclock, version_id are left untouched
if not found.

- anon, id_filter are nullified in the beginning.

Is there a reason why all the parameters can't be set to defaults / reset
right in xrow_decode_subscribe() before the body is decoded?


More information about the Tarantool-patches mailing list