diff options
| -rw-r--r-- | lstate.h | 11 | ||||
| -rw-r--r-- | manual/manual.of | 10 |
2 files changed, 21 insertions, 0 deletions
| @@ -334,6 +334,12 @@ struct lua_State { | |||
| 334 | 334 | ||
| 335 | /* | 335 | /* |
| 336 | ** Union of all collectable objects (only for conversions) | 336 | ** Union of all collectable objects (only for conversions) |
| 337 | ** ISO C99, 6.5.2.3 p.5: | ||
| 338 | ** "if a union contains several structures that share a common initial | ||
| 339 | ** sequence [...], and if the union object currently contains one | ||
| 340 | ** of these structures, it is permitted to inspect the common initial | ||
| 341 | ** part of any of them anywhere that a declaration of the complete type | ||
| 342 | ** of the union is visible." | ||
| 337 | */ | 343 | */ |
| 338 | union GCUnion { | 344 | union GCUnion { |
| 339 | GCObject gc; /* common header */ | 345 | GCObject gc; /* common header */ |
| @@ -347,6 +353,11 @@ union GCUnion { | |||
| 347 | }; | 353 | }; |
| 348 | 354 | ||
| 349 | 355 | ||
| 356 | /* | ||
| 357 | ** ISO C99, 6.7.2.1 p.14: | ||
| 358 | ** "A pointer to a union object, suitably converted, points to each of | ||
| 359 | ** its members [...], and vice versa." | ||
| 360 | */ | ||
| 350 | #define cast_u(o) cast(union GCUnion *, (o)) | 361 | #define cast_u(o) cast(union GCUnion *, (o)) |
| 351 | 362 | ||
| 352 | /* macros to convert a GCObject into a specific value */ | 363 | /* macros to convert a GCObject into a specific value */ |
diff --git a/manual/manual.of b/manual/manual.of index c37f3061..ff891399 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
| @@ -6813,6 +6813,16 @@ As such, it is only available on some platforms | |||
| 6813 | (Windows, Linux, Mac OS X, Solaris, BSD, | 6813 | (Windows, Linux, Mac OS X, Solaris, BSD, |
| 6814 | plus other Unix systems that support the @id{dlfcn} standard). | 6814 | plus other Unix systems that support the @id{dlfcn} standard). |
| 6815 | 6815 | ||
| 6816 | This function is inherently insecure, | ||
| 6817 | as it allows Lua to call any function in any readable dynamic | ||
| 6818 | library in the system. | ||
| 6819 | (Lua calls any function assuming the function | ||
| 6820 | has a proper prototype and respects a proper protocol | ||
| 6821 | @see{lua_CFunction}. | ||
| 6822 | Therefore, | ||
| 6823 | calling an arbitrary function in an arbitrary dynamic library | ||
| 6824 | more often than not results in an access violation.) | ||
| 6825 | |||
| 6816 | } | 6826 | } |
| 6817 | 6827 | ||
| 6818 | @LibEntry{package.path| | 6828 | @LibEntry{package.path| |
