From 84477e148dccf4665067c0d39006f31bb073cc9e Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Thu, 27 Oct 2022 23:39:06 +0100 Subject: [PATCH] lua: cast through uintptr_t when return a pointer Don't assume size_t can carry pointer provenance and use uintptr_t (identialy on all current platforms) instead. Reviewed-by: Matthew Ahrens Reviewed-by: Richard Yao Signed-off-by: Brooks Davis Closes #14131 --- module/lua/lapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/lua/lapi.c b/module/lua/lapi.c index ed3a0f4cf9..703cf4cc2a 100644 --- a/module/lua/lapi.c +++ b/module/lua/lapi.c @@ -444,7 +444,7 @@ LUA_API const void *lua_topointer (lua_State *L, int idx) { case LUA_TTABLE: return hvalue(o); case LUA_TLCL: return clLvalue(o); case LUA_TCCL: return clCvalue(o); - case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); + case LUA_TLCF: return cast(void *, cast(uintptr_t, fvalue(o))); case LUA_TTHREAD: return thvalue(o); case LUA_TUSERDATA: case LUA_TLIGHTUSERDATA: