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.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Brooks Davis <brooks.davis@sri.com>
Closes openzfs#14131
  • Loading branch information
brooksdavis authored and andrewc12 committed Nov 11, 2022
1 parent 9916106 commit 5a91a02
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 5a91a02

Please sign in to comment.