commit 975d4e0592f980aef09c432302496d834249b6a7
parent 04e495403ba66e88abfb5cc4cf1887f094eea57f
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 3 Dec 2024 10:53:19 -0300
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*).
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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 */