From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Sergey Bronnikov <sergeyb@tarantool.org> Cc: Sergey Bronnikov <estetus@gmail.com>, tarantool-patches@dev.tarantool.org, max.kokryashkin@gmail.com Subject: Re: [Tarantool-patches] [PATCH luajit 2/2][v2] Followup fix for embedded bytecode loader. Date: Mon, 11 Sep 2023 12:26:46 +0300 [thread overview] Message-ID: <ZP7dVhnvZwG_kcDX@root> (raw) In-Reply-To: <ed1c9205-0761-6713-9cd3-04c682111262@tarantool.org> 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 <sergeyb@tarantool.org> > >> > >> (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 > >> --- <snipped> > >> 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 <snipped> > > > >> + * `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; > >> + } <snipped> > >> + 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]. > > > >> + <snipped> > > > > -- > > 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
next prev parent reply other threads:[~2023-09-11 9:31 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-31 11:29 [Tarantool-patches] [PATCH luajit 0/2][v2] Fix " Sergey Bronnikov via Tarantool-patches 2023-08-31 11:30 ` [Tarantool-patches] [PATCH luajit 1/2][v2] " Sergey Bronnikov via Tarantool-patches 2023-08-31 11:49 ` Sergey Bronnikov via Tarantool-patches 2023-09-01 9:42 ` Maxim Kokryashkin via Tarantool-patches 2023-09-04 9:31 ` Sergey Bronnikov via Tarantool-patches 2023-09-05 6:34 ` Maxim Kokryashkin via Tarantool-patches 2023-09-05 14:10 ` Sergey Kaplun via Tarantool-patches 2023-09-07 15:21 ` Sergey Bronnikov via Tarantool-patches 2023-09-11 8:45 ` Sergey Kaplun via Tarantool-patches 2023-09-12 10:20 ` Sergey Bronnikov via Tarantool-patches 2023-10-31 11:30 ` Sergey Kaplun via Tarantool-patches 2023-09-05 14:12 ` Sergey Kaplun via Tarantool-patches 2023-09-07 7:06 ` Sergey Bronnikov via Tarantool-patches 2023-08-31 11:32 ` [Tarantool-patches] [PATCH luajit 2/2][v2] Followup fix for " Sergey Bronnikov via Tarantool-patches 2023-09-01 10:05 ` Maxim Kokryashkin via Tarantool-patches 2023-09-04 16:34 ` Sergey Bronnikov via Tarantool-patches 2023-09-05 6:45 ` Maxim Kokryashkin via Tarantool-patches 2023-09-05 12:55 ` Sergey Kaplun via Tarantool-patches 2023-09-07 7:04 ` Sergey Bronnikov via Tarantool-patches 2023-09-11 9:26 ` Sergey Kaplun via Tarantool-patches [this message] 2023-09-12 10:30 ` Sergey Bronnikov via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=ZP7dVhnvZwG_kcDX@root \ --to=tarantool-patches@dev.tarantool.org \ --cc=estetus@gmail.com \ --cc=max.kokryashkin@gmail.com \ --cc=sergeyb@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit 2/2][v2] Followup fix for embedded bytecode loader.' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox