From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id F29CE6EC40; Fri, 4 Jun 2021 13:52:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F29CE6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1622803924; bh=4WNYtT73pMV6mWboTeCtlVaggw6jiAd1rvarsaHjM8Q=; h=To:Cc:References:In-Reply-To:Date:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=rfxjAMJT4IZ9jIr7gMYkLmLZ0HjhnLb99JxZqEnZzODsn1D0ZV0Ybtq3ILZXOarCz wa7taQml72k242no7kMbTxCwNzoCyjpWbj61KngEEB9TFJGeWgY038W68D/BJubRmF TPUHZtXtF/VA3HGnB14cCkQexdsqTR56RiurwVzk= Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (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 CDD506EC40 for ; Fri, 4 Jun 2021 13:52:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CDD506EC40 Received: by smtp51.i.mail.ru with esmtpa (envelope-from ) id 1lp7Qn-0006Px-75; Fri, 04 Jun 2021 13:52:01 +0300 To: Cc: References: <914c02c99c616bef3d5ff87306c79a7921dfeec7.1622803707.git.imeevma@gmail.com> In-Reply-To: <914c02c99c616bef3d5ff87306c79a7921dfeec7.1622803707.git.imeevma@gmail.com> Date: Fri, 4 Jun 2021 13:52:01 +0300 Message-ID: <0d1001d7592f$a658ee60$f30acb20$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQCVglr8SKro6xjFAi0STREEOgyZRq2HWlLQ Content-Language: ru X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C544BBC2A69B1B4100B389BF69B7A224D7C182A05F538085040B10F92B8D6039CED9B8B863102A8E35FAA3AF628DD4B6EFF9A1957734478ABFB X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE705C173BDDADFC82AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006377CC130305260E47D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D89853262CC3867B5B659403D9619D7836117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC55B19328CBC4F849A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B1593CA6EC85F86D28451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE91ADC097FE2C3A08985B8ACC81218E19D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE34E7D9683544204AF2D242C3BD2E3F4C6C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F79006373BC478629CBEC79DEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A568904A4AA65B7142FD1879EBA3D6B63FD10C07803EAB20F4D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75FBC5FED0552DA851410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349FD10E01B3CDC9E21CD9136C6CDEB3B489B45D10C674843575FD91F021EAB2C8AFDC2692B111264E1D7E09C32AA3244CDE3A4DD616FDF0CED98C77C4DD29AE1905AB220A9D022EBC729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojz99asgmzejof6Ki/OjPJ5g== X-Mailru-Sender: B5B6A6EBBD94DAD8DF9DB9650A8885C887862A4D503CCA2162E3C35B24D2B42475ED0347C6C58DAB1EC9E4A2C82A33BC8C24925A86E657CE0C70AEE3C9A96FBAB3D7EE8ED63280BE112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 1/1] box: check STRING length when it is cast to UUID X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Timur Safin via Tarantool-patches Reply-To: Timur Safin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" LGTM, (with unimportant correction) : From: imeevma@tarantool.org : Sent: Friday, June 4, 2021 1:49 PM : To: tsafin@tarantool.org : Cc: tarantool-patches@dev.tarantool.org : Subject: [PATCH v1 1/1] box: check STRING length when it is cast to = UUID :=20 : After this patch, the tt_uuid_from_strl() function will check the = length : of the given string before converting it to a UUID. :=20 : Follow up #5886 : --- : https://github.com/tarantool/tarantool/issues/5886 : https://github.com/tarantool/tarantool/tree/imeevma/gh-5886-follow-up :=20 : src/lib/uuid/tt_uuid.c | 2 ++ : test/sql-tap/uuid.test.lua | 19 ++++++++++++++++++- : 2 files changed, 20 insertions(+), 1 deletion(-) :=20 : diff --git a/src/lib/uuid/tt_uuid.c b/src/lib/uuid/tt_uuid.c : index 8bc9bc7af..d92376650 100644 : --- a/src/lib/uuid/tt_uuid.c : +++ b/src/lib/uuid/tt_uuid.c : @@ -98,6 +98,8 @@ tt_uuid_str(const struct tt_uuid *uu) : int : tt_uuid_from_strl(const char *in, size_t len, struct tt_uuid *uu) : { : + if (len !=3D UUID_STR_LEN) : + return 1; : char buf[UUID_STR_LEN + 1]; : snprintf(buf, sizeof(buf), "%.*s", (int) len, in); : return tt_uuid_from_string(buf, uu); : diff --git a/test/sql-tap/uuid.test.lua b/test/sql-tap/uuid.test.lua : index 83fcc3d0e..77ba06c2d 100755 : --- a/test/sql-tap/uuid.test.lua : +++ b/test/sql-tap/uuid.test.lua : @@ -3,7 +3,7 @@ local build_path =3D os.getenv("BUILDDIR") : package.cpath =3D = build_path..'/test/sql-tap/?.so;'..build_path..'/test/sql- : tap/?.dylib;'..package.cpath :=20 : local test =3D require("sqltester") : -test:plan(145) : +test:plan(147) :=20 : local uuid =3D require("uuid") : local uuid1 =3D uuid.fromstr("11111111-1111-1111-1111-111111111111") : @@ -1316,6 +1316,23 @@ test:do_execsql_test( : true : }) :=20 : +-- Make sure STRING of wrong length cannot be cast to UUID. 'cannot be casted' : +test:do_catchsql_test( : + "uuid-17.1", : + [[ : + SELECT = CAST('11111111-1111-1111-1111-111111111111111222222222' AS : UUID); : + ]], { : + 1, "Type mismatch: can not convert 11111111-1111-1111-1111- : 111111111111111222222222 to uuid" : + }) : + : +test:do_catchsql_test( : + "uuid-17.2", : + [[ : + SELECT CAST('11111111-1111-1111-1111-11111' AS UUID); : + ]], { : + 1, "Type mismatch: can not convert = 11111111-1111-1111-1111-11111 to : uuid" : + }) : + : test:execsql([[ : DROP TRIGGER t; : DROP VIEW v; : -- : 2.25.1