Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: v.shpilevoy@tarantool.org, gorcunov@gmail.com
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 2/2] xrow: reset parameters of decode_subscribe() to default
Date: Thu,  2 Sep 2021 16:21:34 +0300	[thread overview]
Message-ID: <7b374c0b4f05562ef0e1e65ea3270f3e9aa57f68.1630588778.git.sergepetrenko@tarantool.org> (raw)
In-Reply-To: <cover.1630588778.git.sergepetrenko@tarantool.org>

Nullify all the output parameters passed to xrow_decode_subscribe().

This should help us get rid of cases when some of the parameters were
left uninitialized when the SUBSCRIBE request didn't contain the
corresponding fields.

Follow-up #6034
---
 src/box/xrow.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/box/xrow.c b/src/box/xrow.c
index 7df1af4ab..3cad2c1be 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -1561,10 +1561,19 @@ xrow_decode_subscribe(struct xrow_header *row, struct tt_uuid *replicaset_uuid,
 		return -1;
 	}
 
-	if (anon)
+	if (replicaset_uuid != NULL)
+		*replicaset_uuid = uuid_nil;
+	if (instance_uuid != NULL)
+		*instance_uuid = uuid_nil;
+	if (vclock != NULL)
+		vclock_create(vclock);
+	if (version_id != NULL)
+		*version_id = 0;
+	if (anon != NULL)
 		*anon = false;
-	if (id_filter)
+	if (id_filter != NULL)
 		*id_filter = 0;
+
 	d = data;
 	uint32_t map_size = mp_decode_map(&d);
 	for (uint32_t i = 0; i < map_size; i++) {
-- 
2.30.1 (Apple Git-130)


  parent reply	other threads:[~2021-09-02 13:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 13:21 [Tarantool-patches] [PATCH v2 0/2] replication: fix uninitialized replica_version_id access Serge Petrenko via Tarantool-patches
2021-09-02 13:21 ` [Tarantool-patches] [PATCH v2 1/2] box: remove unused variable in process_register() Serge Petrenko via Tarantool-patches
2021-09-02 13:21 ` Serge Petrenko via Tarantool-patches [this message]
2021-09-02 21:47   ` [Tarantool-patches] [PATCH v2 2/2] xrow: reset parameters of decode_subscribe() to default Vladislav Shpilevoy via Tarantool-patches
2021-09-06  8:06     ` Serge Petrenko via Tarantool-patches
2021-09-07 21:46       ` Vladislav Shpilevoy via Tarantool-patches
2021-09-02 17:34 ` [Tarantool-patches] [PATCH v2 0/2] replication: fix uninitialized replica_version_id access Cyrill Gorcunov via Tarantool-patches
2021-09-09 10:18 ` Kirill Yukhin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b374c0b4f05562ef0e1e65ea3270f3e9aa57f68.1630588778.git.sergepetrenko@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/2] xrow: reset parameters of decode_subscribe() to default' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox