From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B1FD92F328 for ; Thu, 6 Dec 2018 05:13:31 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EkQa3bn_ci_O for ; Thu, 6 Dec 2018 05:13:31 -0500 (EST) Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 1E6C62862D for ; Thu, 6 Dec 2018 05:13:28 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: fix tarantoolSqlite3TupleColumnFast From: "n.pettik" In-Reply-To: <2c7b9e1f-f462-1439-4c85-990c95d5de2b@tarantool.org> Date: Thu, 6 Dec 2018 13:13:19 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <03BE18E7-2EEE-4D82-A236-A5C9744AB66C@tarantool.org> References: <2c7b9e1f-f462-1439-4c85-990c95d5de2b@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Kirill Shcherbatov , Vladislav Shpilevoy > On 6 Dec 2018, at 12:17, Vladislav Shpilevoy = wrote: >=20 > On 06/12/2018 09:59, Kirill Shcherbatov wrote: >> 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 =3D=3D 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 <=3D 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 =3D=3D 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 >=20 > LGTM. Nikita, please, review. Especially English part. LGTM as well.=