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

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Sep 2 00:35:35 MSK 2021


On 31.08.2021 11:17, Serge Petrenko wrote:
> 
> 
> 31.08.2021 00:38, Vladislav Shpilevoy пишет:
>> 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?
> I think not. Would you prefer nullifying all the parameters in
> xrow_decode_subscribe() body?

Yes, it would be more reliable I think.


More information about the Tarantool-patches mailing list