Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: fix tarantoolSqlite3TupleColumnFast
Date: Thu, 6 Dec 2018 09:59:21 +0300	[thread overview]
Message-ID: <df9114ba-663e-3065-8d99-c6f2a70f7577@tarantool.org> (raw)
In-Reply-To: <f33a53d8-6e45-f31e-dc6c-e86860de5000@tarantool.org>

Hi! Thank you for research, I've included your conclusions to
the commit message.


The tarantoolSqlite3TupleColumnFast routine used to lookup
offset_slot in unallocated memory in some cases.
The assert with exact_field_count same as motivation to change
old correct assert with field_count in 7a8de28 is not correct.
assert(format->exact_field_count == 0 ||
       fieldno < format->exact_field_count);
The tarantoolSqlite3TupleColumnFast routine requires offset_slot
that has been allocated during tuple_format_create call. This
value is stored in indexed field with index that limited with
index_field_count that is <= field_count. Look at
tuple_format_alloc for more details.

The format in cursor triggering valid assertion has such
structure because first 4 tuples in _space: 257, 272, 276 and
280 have an old format of _space with only one field
(format->field_count == 1).
It happens because these 4 tuples are recovered not after tuple
with id 280 which stores actual format of _space. After tuple
280 is recovered, an actual format is set in struct space of
_space and all next tuples have full featured formats.

So for these 4 tuples tarantoolSqlite3TupleColumnFast can fail
even if a field exists, is indexed and has a name. Those
features are just described in a newer format.
(thank Gerold103 for problem explanation)

Closes #3772

  reply	other threads:[~2018-12-06  6:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a2427513583b3c0e63f9e976babdf84fe6a9a6dd.1543945044.git.kshcherbatov@tarantool.org>
2018-12-05 20:23 ` Vladislav Shpilevoy
2018-12-05 20:41   ` Kirill Shcherbatov
2018-12-05 21:23     ` Vladislav Shpilevoy
2018-12-06  6:59       ` Kirill Shcherbatov [this message]
2018-12-06  9:17         ` Vladislav Shpilevoy
2018-12-06 10:13           ` n.pettik
2018-12-06 15:05   ` Kirill Yukhin

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=df9114ba-663e-3065-8d99-c6f2a70f7577@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: fix tarantoolSqlite3TupleColumnFast' \
    /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