From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 7FA3B6EC5A; Thu, 2 Sep 2021 00:35:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7FA3B6EC5A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1630532139; bh=TNQViReQMoq4FDEyF3cKvDBsQAYxCRiWglOmlntFHpQ=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=bQRfbl9hitInMd7rAUfk4aan95O/4qoYPaZBszYRNHtOPHrT+c4qJTpME0Qe5wX6l jjSV7FmP6nzar6zmS4tCK75UyuAIAzYrR1fP1VyZ3JcB/zanuQpLmELywM2HtBIgxw 13N0IaFCzh0tDoQhM4IEzyho10gj81ouO+nWIGdo= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id BB6466EC5A for ; Thu, 2 Sep 2021 00:35:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BB6466EC5A Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1mLXtR-0001ot-3t; Thu, 02 Sep 2021 00:35:37 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <8f2f052fe5c362de28a8e6b472c7608902be60a2.1630319507.git.sergepetrenko@tarantool.org> <385ccffc-abee-b0be-4805-addbff4efcd7@tarantool.org> <822222ec-57f0-71eb-9473-360fefe9e385@tarantool.org> Message-ID: <7758333c-1201-fa2d-6223-2bf4f3065bcf@tarantool.org> Date: Wed, 1 Sep 2021 23:35:35 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <822222ec-57f0-71eb-9473-360fefe9e385@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9EE8D69D3379D80C412F6C48019D6987C8600846831C518E9182A05F538085040F818BF0D2EA0D73665AE3D6D5F55087E4C7043FE43058026B6BF1A3C03F0F3BA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72C932D6B54DFB189EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375C4806A08D329A618638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D88755CCC1C8D04F68C31021CFD0EAC19B117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC292D688DDAD4E7BC389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC81F9513A7CA91E555F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B2303E78B907142AC75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505911838DF6BD49F1F0175CE3554288535 X-C1DE0DAB: 0D63561A33F958A556EC981801B9E56C737E3C14C3310DB6FDFB288520394761D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA752546FE575EB473F1410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34E3E1DC0F9BD553099A167281621A3B153EAEB2031B8849E250E5723C900F67C7A25AB858C3D9FE031D7E09C32AA3244C228E3B47A8216D48BE7BAD9A4412FC3EBBA718C7E6A9E042FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojK/h3ZnmlPjFRvJvP3Zd3rA== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D52C08D5295D8DE4CF852BE3577EA63303841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 2/2] box: fix uninitialized access to version_id in process_subscribe() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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.