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 938E91BE9A1; Wed, 8 Nov 2023 22:00:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 938E91BE9A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1699470009; bh=qnkOccAMfg2dDgiMT6M+lkY1jiqgbeD9VSFKGh3iIKU=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=xIxnCEEJNHqzy6o2sviybbZzBFvcAuw4FzVtJRLGMDDauFlBHFIyl1rziiVoERpX0 BVBDHO/RUzUnUuvRObE0hZ8GCFOGwbw9uhpCE/lED2nNxm1p7iaUbtSFyniv5iMvVK GDGQJHRYB6jES8t9lTS6lbOAFU1uxlos9ALwBUsA= Received: from smtp42.i.mail.ru (smtp42.i.mail.ru [95.163.41.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 563041BE9A1 for ; Wed, 8 Nov 2023 22:00:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 563041BE9A1 Received: by smtp42.i.mail.ru with esmtpa (envelope-from ) id 1r0nmY-004jbP-2g; Wed, 08 Nov 2023 22:00:07 +0300 Date: Wed, 8 Nov 2023 21:59:36 +0300 To: Sergey Kaplun Message-ID: <4gevtnryseliehscuvbe3gel6y44uoe3yyez7jqnnuf6f3i6al@mkpo7il6gdvm> References: <20231108084044.6654-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231108084044.6654-1-skaplun@tarantool.org> X-Mailru-Src: smtp X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9C2A6B03AB739174C8B8ADBDCDAD54AB847BB7A66D7B1BE8200894C459B0CD1B9B4619D789FD27E2E3AFDE4EA392FD6048371E42FEEF9505628006A18B89A766F X-C1DE0DAB: 0D63561A33F958A55ED93A8BCA328A86EC71EDFE3F614A51EBCB193E1290E3C7F87CCE6106E1FC07E67D4AC08A07B9B01DAA61796BF5227BCB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0AD5177F0B940C8B66ECE892A7B2722663E91682638B966EB3F662256BEEFA9527FA678939F2B277D4D7953851C462FB9C07A1C70FA8B3580AF24217C5FF32E5EC1FCB4DD0B4C8C2DBF37FD76D11AF80A0D0B1F0C0449B90162228D4A931B59B15DEA455F16B58544A21C197AAF4D2E4732965026E5D17F6739C77C69D99B9914278E50E1F0597A6FD5CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojGx6zOZpnTNC9HsssUq3csg== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE407B63390373F784390A56D4011DF9B6E113A7A9A8B07ACFACAD51284F0FE6F529ABC7555A253F5B200DF104D74F62EE79D27EC13EC74F6107F4198E0F3ECE9B5443453F38A29522196 X-Mras: OK Subject: Re: [Tarantool-patches] [PATCH luajit] FFI: Fix pragma push stack limit check and throw on overflow. 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the patch! LGTM after fixing the comment left by Igor, and one additional comment from me (see it below). On Wed, Nov 08, 2023 at 11:40:44AM +0300, Sergey Kaplun wrote: > From: Mike Pall > > Reported by Sergey Kaplun. > > (cherry-picked from commit 433d7e8d8d182f44e88b5cfdc4b2d3026469dfb7) > > `cp->packstack` is the array of size `CPARSE_MAX_PACKSTACK` (7). Before > the patch, `cp->curpack` is checked to be less than > `CPARSE_MAX_PACKSTACK`, but then `cp->packstack` is accessed at > `cp->curpack + 1`, which is out of bounds, so `cp->curpack` value is > overwritten. > > This patch fixes a condition and also adds the error throw when counter > is overflow (instead of rewriting a top `cp->packstack` value). > > Sergey Kaplun: > * added the description and the test for the problem > > Resolves tarantool/tarantool#9339 > Part of tarantool/tarantool#9145 > --- > > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-1114-ffi-pragma-pack > Tarantool PR: https://github.com/tarantool/tarantool/pull/9342 > Relate issues: > * https://github.com/LuaJIT/LuaJIT/issues/1114 > * https://github.com/tarantool/tarantool/issues/9339 > * https://github.com/tarantool/tarantool/issues/9145 > > src/lj_cparse.c | 4 +- > .../lj-1114-ffi-pragma-pack.test.lua | 44 +++++++++++++++++++ > 2 files changed, 47 insertions(+), 1 deletion(-) > create mode 100644 test/tarantool-tests/lj-1114-ffi-pragma-pack.test.lua > > diff --git a/src/lj_cparse.c b/src/lj_cparse.c > index 6d9490ca..01deb3bf 100644 > --- a/src/lj_cparse.c > +++ b/src/lj_cparse.c > diff --git a/test/tarantool-tests/lj-1114-ffi-pragma-pack.test.lua b/test/tarantool-tests/lj-1114-ffi-pragma-pack.test.lua > new file mode 100644 > index 00000000..e5642828 > --- /dev/null > +++ b/test/tarantool-tests/lj-1114-ffi-pragma-pack.test.lua > @@ -0,0 +1,44 @@ > +test:ok(not err, 'the error is thrown when couner overflows') Typo: s/couner/counter/ > +test:like(msg, 'chunk has too many syntax levels', > + 'the error message is correct') > + > +test:done(true) > -- > 2.42.0 >