[tarantool-patches] Re: [PATCH] lua,fiber: Fix abort on malformed join input
Георгий Кириченко
georgy at tarantool.org
Sat Feb 23 15:21:25 MSK 2019
Hi!
The patch looks good for me but could you please add a small test case.
Some examples might be found in test/app/fiber.test.lua file.
On Friday, February 22, 2019 10:53:58 PM MSK Cyrill Gorcunov wrote:
> If I create a new fiber and the join to himself we get an abort:
> | tarantool> f = require('fiber')
> | ---
> | ...
> |
> | tarantool> f.join(f.self())
> | tarantool: src/fiber.c:407: fiber_join: Assertion `fiber->flags &
> | FIBER_IS_JOINABLE' failed. Aborted (core dumped)
>
> we should better throw an error.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
> ---
> src/lua/fiber.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> Index: tarantool.git/src/lua/fiber.c
> ===================================================================
> --- tarantool.git.orig/src/lua/fiber.c
> +++ tarantool.git/src/lua/fiber.c
> @@ -676,10 +676,14 @@ lbox_fiber_join(struct lua_State *L)
> {
> struct fiber *fiber = lbox_checkfiber(L, 1);
> struct lua_State *child_L = fiber->storage.lua.stack;
> - fiber_join(fiber);
> struct error *e = NULL;
> int num_ret = 0;
> int coro_ref = 0;
> +
> + if (!(fiber->flags & FIBER_IS_JOINABLE))
> + luaL_error(L, "the fiber is not joinable");
> + fiber_join(fiber);
> +
> if (child_L != NULL) {
> coro_ref = lua_tointeger(child_L, -1);
> lua_pop(child_L, 1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20190223/aa4d7ee1/attachment.sig>
More information about the Tarantool-patches
mailing list