瀏覽代碼

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*).
Roberto Ierusalimschy 8 月之前
父節點
當前提交
975d4e0592
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lfunc.h

+ 1 - 1
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 */