From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 8FCAF27A65 for ; Sat, 23 Feb 2019 07:21:31 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h6FAlEqkJ0b0 for ; Sat, 23 Feb 2019 07:21:31 -0500 (EST) Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 4626327A5E for ; Sat, 23 Feb 2019 07:21:31 -0500 (EST) From: =?utf-8?B?0JPQtdC+0YDQs9C40Lkg0JrQuNGA0LjRh9C10L3QutC+?= Subject: [tarantool-patches] Re: [PATCH] lua,fiber: Fix abort on malformed join input Date: Sat, 23 Feb 2019 15:21:25 +0300 Message-ID: <1611984.4X4OdZQF8j@home.lan> In-Reply-To: <20190222195358.GZ7198@uranus> References: <20190222195358.GZ7198@uranus> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2894600.4G63rKvfuE"; micalg="pgp-sha256"; protocol="application/pgp-signature" Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Cyrill Gorcunov --nextPart2894600.4G63rKvfuE Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 > --- > 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); --nextPart2894600.4G63rKvfuE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEFB+nbqWGnp59Rk9ZFSyY70x8X3sFAlxxOsUACgkQFSyY70x8 X3tTggf/QcD7sLfdKpHxyS/vbc4k58RM1AOr0XJ5OR2jNuIbredWp+o39CWXXdbV 29QjuL/i+7UQ+4VntHPMEdTrDK2swTVEaMi064XFyKlfrkSv277Qbqj0KTZ2+NEY Hoch1jBZOH1ba0tN/tD1C3cajRqXAWkoWVg6g12OSOhWhSkeYWR8JwekVjJ6zyeI s+mmGLrGwrM5Klphdev2cKOiQ0dN2S0mqrc2Ir1JxOvjgwXhv8lns69+5KRWPK+t vbOV9klyQjY1iQUHh9lrRsoWPAk/3GfC/l6DV3cjWX1u+/jtdk3lCr1JW6NS6zXM UWC9hVut9+Qy0nAimiMnuNV3wjNaVQ== =oN2b -----END PGP SIGNATURE----- --nextPart2894600.4G63rKvfuE--