Skip to content

Commit

Permalink
lua: cast through uintptr_t when return a pointer
Browse files Browse the repository at this point in the history
Don't assume size_t can carry pointer provenance and use uintptr_t
(identialy on all current platforms) instead.

Signed-off-by: Brooks Davis <brooks.davis@sri.com>
  • Loading branch information
brooksdavis committed Nov 2, 2022
1 parent 5342466 commit 849e2ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/lua/lapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 849e2ce

Please sign in to comment.