[Tarantool-patches] [PATCH luajit 6/6] FFI: Fix dangling reference to CType in carith_checkarg().

Sergey Kaplun skaplun at tarantool.org
Wed Oct 25 13:48:16 MSK 2023


Hi, Maxim!
Thanks for the review!

On 25.10.23, Maxim Kokryashkin wrote:
> Hi, Sergey!
> LGTM, after fixing the same comments, as for the previous patches.

See the iterative patch below, branch is force-pushed.
===================================================================
diff --git a/test/tarantool-tests/lj-1108-fix-dangling-reference-to-ctype.test.lua b/test/tarantool-tests/lj-1108-fix-dangling-reference-to-ctype.test.lua
index 43a39886..a077344e 100644
--- a/test/tarantool-tests/lj-1108-fix-dangling-reference-to-ctype.test.lua
+++ b/test/tarantool-tests/lj-1108-fix-dangling-reference-to-ctype.test.lua
@@ -10,7 +10,7 @@ test:plan(1)
 -- This test demonstrates LuaJIT's incorrect behaviour when the
 -- reallocation of `cts->tab` strikes during the arithmetic cdata
 -- metamethod.
--- The test fails under ASAN.
+-- Before the patch, the test failed only under ASAN.
 
 -- XXX: Just some C functions to be casted. There is no need to
 -- declare their prototypes correctly.
@@ -37,6 +37,9 @@ local _ = ffi.new('struct {int a; long b; float c; double d;}', 0)
 -- Anchor table to prevent cdata objects from being collected.
 local anchor = {}
 -- Each call to this function grows `cts->top` by 3.
+-- `lj_ctype_new()` and `lj_ctype_intern()` during the parsing of
+-- the `CType` declaration in the `ffi.cast()` plus
+-- `lj_ctype_intern()` during the conversion to another `CType`.
 local function save_new_func(func)
   anchor[#anchor + 1] = ffi.cast('void (*)(void)', func)
 end
===================================================================

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list