From 975d4e0592f980aef09c432302496d834249b6a7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 3 Dec 2024 10:53:46 -0300 Subject: Fix in the definition of 'sizeLclosure' The array at the end of a Lua closure has pointers to upvalues, not to tagged values. This bug cannot cause any issue: The ISO C standard requires that all pointers to structures have the same representation, so sizeof(TValue*) must be equal to sizeof(UpVal*). --- lfunc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lfunc.h') diff --git a/lfunc.h b/lfunc.h index b981edeb..342389e4 100644 --- a/lfunc.h +++ b/lfunc.h @@ -15,7 +15,7 @@ (offsetof(CClosure, upvalue) + sizeof(TValue) * cast_uint(n)) #define sizeLclosure(n) \ - (offsetof(LClosure, upvals) + sizeof(TValue *) * cast_uint(n)) + (offsetof(LClosure, upvals) + sizeof(UpVal *) * cast_uint(n)) /* test whether thread is in 'twups' list */ -- cgit v1.2.3-55-g6feb