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 0D2445DFA6C; Mon, 11 Sep 2023 12:31:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0D2445DFA6C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1694424692; bh=75wsvpEEs6UGgGog1zcwXedz7GoaQnT1PEPX44hJbfM=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=UERyuhKfgWO1Sm6FIbX+g5hsAJHYDMmt3ikMCaiNJyFlZqvnuqFKzMXZY4vPKrOW/ sChqvFPWTWYDWr9cz2TTFOs7BjyKiURwRIala07g9x1derqpt45mKofrFlCnLqHq6E jc/+BmVivpm35BWh3dAwuPG57/H9aWtpN/ZmEbpU= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [95.163.41.78]) (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 BFEAD5DF7A7 for ; Mon, 11 Sep 2023 12:31:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BFEAD5DF7A7 Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1qfdGT-000KzP-1Y; Mon, 11 Sep 2023 12:31:29 +0300 Date: Mon, 11 Sep 2023 12:26:46 +0300 To: Sergey Bronnikov Cc: Sergey Bronnikov , tarantool-patches@dev.tarantool.org, max.kokryashkin@gmail.com Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD96201AD55A1C8F7DB4B94316895B7D143959E6F65F85AE25C182A05F5380850404C228DA9ACA6FE271DDFEBFAF56C570B2953B37C4D0B5511F8C015A8A75460972E023708DF3E1D14 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DB6A86BDF2D5A895EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006374E88016F1B7D8D248638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D80ADD8086DC76F6A8574BFA5549D0BCCE117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC6F8235414F7F731CA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18E5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE0AC5B80A05675ACD4DC33E588678F033D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3F8BD4E506CFA3D8803F1AB874ED89028C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947C2FFDA4F57982C5F42E808ACE2090B5E1725E5C173C3A84C317B107DEF921CE79089D37D7C0E48F6C8AA50765F7900637C3090DF2C0002BD1EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5A9E7BDFFA0B57C7125907C8DE3AAAB3B437D70C50AAD935AF87CCE6106E1FC07E67D4AC08A07B9B08ED1AC82D843A2BBCB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF6F318F36FCBA268936D806B1A7614BF3C4D019513B9C0248F8B90D9BACDE2241508B3DC588E9D1C7A44234FD4F46A84333E50F5D644949DA36C3567DE1D2077CA74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojGCuXuOfYMcaj09w55yEY5w== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A7690E7AABA313A293C92953B37C4D0B5511E28E2421BF3B429ADEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/2][v2] Followup fix for embedded bytecode loader. 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: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the fixes and clarifications! LGTM, after answering to my comments below. On 07.09.23, Sergey Bronnikov wrote: > Hi, Sergey > > On 9/5/23 15:55, Sergey Kaplun wrote: > > Hi, Sergey! > > Thanks for the patch! > > Please, consider my comments below. > > > > On 31.08.23, Sergey Bronnikov wrote: > >> From: Sergey Bronnikov > >> > >> (cherry-picked from commit e49863eda13d095b1a78fd4ca0fd3a6a9a17d782) > >> > >> The patch follows up a previous patch and limits the total size of a > >> chunk load by `lua_load` with size `LJ_MAX_BUF - 1`. > >> > >> Sergey Bronnikov: > >> * added the description and the test > >> --- > >> diff --git a/test/tarantool-c-tests/lj-549-lua_load.test.c b/test/tarantool-c-tests/lj-549-lua_load.test.c > >> new file mode 100644 > >> index 00000000..9baa7a1a > >> --- /dev/null > >> +++ b/test/tarantool-c-tests/lj-549-lua_load.test.c > > > >> + * `lex_more`. > >> + */ > >> + assert_true(res != LUA_ERRMEM); > > Maybe it's better to use here codition res == LUA_OK? > > > >> + lua_settop(L, 0); > >> + > >> + return TEST_EXIT_SUCCESS; > >> + } > >> + static const char * > >> + bc_reader_with_eof(lua_State *L, void *data, size_t *size) > >> + { > >> + UNUSED(L); > >> + dt *test_data = (dt *)data; > >> + if (test_data->state == EMIT_EOF) { > >> + *size = 0; > >> + return NULL; > >> + } > >> + > >> + static char *bc_chunk = NULL; > >> + free(bc_chunk); > > This free is called only once, when bc_chunk is already NULL. > > I suggest moving the initialization of the `bc_chunk` to the beginning > > of the scope and calling `free()` only for the `EMIT_EOF` state (it's > > also a little bit more readable -- a reader shouldn't remember that > > `free(NULL)` is OK). > Updated. Unfortunately, I don't see these changes on branch [1]. > > > >> + > > > > -- > > Best regards, > > Sergey Kaplun [1]: https://github.com/tarantool/luajit/blob/f7e5e8abe396411065f8941d04879577e7fae175/test/tarantool-c-tests/lj-549-lua-load.test.c#L70 -- Best regards, Sergey Kaplun