From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp45.i.mail.ru (smtp45.i.mail.ru [94.100.177.105]) (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 A9F49430408 for ; Wed, 12 Aug 2020 16:05:14 +0300 (MSK) References: <53095890-c0b6-6eae-b3b1-9898e7ca05e3@tarantool.org> <8d39159c-31d3-1394-fb04-4793da531772@tarantool.org> From: Aleksandr Lyapunov Message-ID: <184a98de-9f49-be82-39a5-84b3c7510697@tarantool.org> Date: Wed, 12 Aug 2020 16:05:13 +0300 MIME-Version: 1.0 In-Reply-To: <8d39159c-31d3-1394-fb04-4793da531772@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [Tarantool-patches] [PATCH 1/2] tuple: fix multikey field JSON access crash List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, korablev@tarantool.org Hi! thanks for the fix, as for me it became more understandable. See one minor comment below and LGTM. On 8/12/20 12:24 AM, Vladislav Shpilevoy wrote: > Hi! Thanks for the review! > > + if (offset_slot_hint != NULL) { > *offset_slot_hint = offset_slot; > + /* > + * Hint is never requested for a multikey field without > + * providing a concrete multikey index. > + */ > + assert(!field->is_multikey_part || > + (multikey_idx != MULTIKEY_NONE && > + field->is_multikey_part)); The last '&& field->is_multikey_part' is excess. > + } else if (field->is_multikey_part && > + multikey_idx == MULTIKEY_NONE) { > + /* > + * When the field is multikey, the offset slot points > + * not at the data. It points at 'extra' array of > + * offsets for this multikey index. That array can only > + * be accessed if index in that array is known. It is > + * not known when the field is accessed not in an index. > + * For example, in an application's Lua code by a JSON > + * path. > + */ > + goto parse; > + } > offset_slot_access: > /* Indexed field */ > offset = field_map_get_offset(field_map, offset_slot,