diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-12-03 10:53:46 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-12-03 10:53:46 -0300 |
commit | 975d4e0592f980aef09c432302496d834249b6a7 (patch) | |
tree | 6cedfb17d1c001116df4a6f18510473fbfe28727 | |
parent | 04e495403ba66e88abfb5cc4cf1887f094eea57f (diff) | |
download | lua-975d4e0592f980aef09c432302496d834249b6a7.tar.gz lua-975d4e0592f980aef09c432302496d834249b6a7.tar.bz2 lua-975d4e0592f980aef09c432302496d834249b6a7.zip |
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*).
-rw-r--r-- | lfunc.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -15,7 +15,7 @@ | |||
15 | (offsetof(CClosure, upvalue) + sizeof(TValue) * cast_uint(n)) | 15 | (offsetof(CClosure, upvalue) + sizeof(TValue) * cast_uint(n)) |
16 | 16 | ||
17 | #define sizeLclosure(n) \ | 17 | #define sizeLclosure(n) \ |
18 | (offsetof(LClosure, upvals) + sizeof(TValue *) * cast_uint(n)) | 18 | (offsetof(LClosure, upvals) + sizeof(UpVal *) * cast_uint(n)) |
19 | 19 | ||
20 | 20 | ||
21 | /* test whether thread is in 'twups' list */ | 21 | /* test whether thread is in 'twups' list */ |