From: Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: v.shpilevoy@tarantool.org, sergos@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v3 1/2] sql: Initialize MEM in sqlVdbeAllocUnpackedRecord() Date: Sat, 20 Feb 2021 19:59:23 +0300 [thread overview] Message-ID: <4fd025ad9d8b201c89ab96ce7bc9c68fc1aa67e9.1613839653.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1613839653.git.imeevma@gmail.com> This patch adds initialization for newly created MEM objects in sqlVdbeAllocUnpackedRecord(). Changing a MEM without being initialized may give us unexpected result. Part of #5818 --- src/box/sql/vdbeaux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c index 91b64316e..5c2706e49 100644 --- a/src/box/sql/vdbeaux.c +++ b/src/box/sql/vdbeaux.c @@ -2329,6 +2329,8 @@ sqlVdbeAllocUnpackedRecord(struct sql *db, struct key_def *key_def) if (!p) return 0; p->aMem = (Mem *) & ((char *)p)[ROUND8(sizeof(UnpackedRecord))]; + for (uint32_t i = 0; i < key_def->part_count + 1; ++i) + sqlVdbeMemInit(&p->aMem[i], sql_get(), MEM_Null); p->key_def = key_def; p->nField = key_def->part_count + 1; return p; -- 2.25.1
next prev parent reply other threads:[~2021-02-20 16:59 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-20 16:59 [Tarantool-patches] [PATCH v3 0/2] Encapsulate MEM type changing and checking Mergen Imeev via Tarantool-patches 2021-02-20 16:59 ` Mergen Imeev via Tarantool-patches [this message] 2021-02-20 16:59 ` [Tarantool-patches] [PATCH v3 2/2] sql: " Mergen Imeev via Tarantool-patches 2021-02-28 17:35 ` Vladislav Shpilevoy via Tarantool-patches 2021-03-23 13:07 ` Mergen Imeev via Tarantool-patches 2021-02-28 17:35 ` [Tarantool-patches] [PATCH v3 0/2] " Vladislav Shpilevoy via Tarantool-patches 2021-03-23 12:34 ` Mergen Imeev 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=4fd025ad9d8b201c89ab96ce7bc9c68fc1aa67e9.1613839653.git.imeevma@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=imeevma@tarantool.org \ --cc=sergos@tarantool.org \ --cc=tsafin@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v3 1/2] sql: Initialize MEM in sqlVdbeAllocUnpackedRecord()' \ /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