diff options
| author | Mike Pall <mike> | 2026-05-25 01:28:32 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2026-05-25 01:28:32 +0200 |
| commit | 8f421c81ec6aaae0bcd80e01f4353de200afbbc5 (patch) | |
| tree | 6c640a8bb72a3ba5821780974bb5fda75021a378 /src | |
| parent | 5c12243677d2bb97974d634ff172570cea2a37dc (diff) | |
| download | luajit-8f421c81ec6aaae0bcd80e01f4353de200afbbc5.tar.gz luajit-8f421c81ec6aaae0bcd80e01f4353de200afbbc5.tar.bz2 luajit-8f421c81ec6aaae0bcd80e01f4353de200afbbc5.zip | |
Prevent sanitizer warnings for lj_tab_new*() and table.new().
Reported by Sergey Bronnikov. #1458
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_api.c | 2 | ||||
| -rw-r--r-- | src/lj_tab.c | 4 | ||||
| -rw-r--r-- | src/lj_tab.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/lj_api.c b/src/lj_api.c index 6369c17db..f972a760b 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
| @@ -708,7 +708,7 @@ LUA_API void lua_pushlightuserdata(lua_State *L, void *p) | |||
| 708 | LUA_API void lua_createtable(lua_State *L, int narray, int nrec) | 708 | LUA_API void lua_createtable(lua_State *L, int narray, int nrec) |
| 709 | { | 709 | { |
| 710 | lj_gc_check(L); | 710 | lj_gc_check(L); |
| 711 | settabV(L, L->top, lj_tab_new_ah(L, narray, nrec)); | 711 | settabV(L, L->top, lj_tab_new_ah(L, (uint32_t)narray, (uint32_t)nrec)); |
| 712 | incr_top(L); | 712 | incr_top(L); |
| 713 | } | 713 | } |
| 714 | 714 | ||
diff --git a/src/lj_tab.c b/src/lj_tab.c index c63117fa4..f9dd541be 100644 --- a/src/lj_tab.c +++ b/src/lj_tab.c | |||
| @@ -145,9 +145,9 @@ GCtab *lj_tab_new(lua_State *L, uint32_t asize, uint32_t hbits) | |||
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | /* The API of this function conforms to lua_createtable(). */ | 147 | /* The API of this function conforms to lua_createtable(). */ |
| 148 | GCtab *lj_tab_new_ah(lua_State *L, int32_t a, int32_t h) | 148 | GCtab *lj_tab_new_ah(lua_State *L, uint32_t a, uint32_t h) |
| 149 | { | 149 | { |
| 150 | return lj_tab_new(L, (uint32_t)(a > 0 ? a+1 : 0), hsize2hbits(h)); | 150 | return lj_tab_new(L, a ? a+1 : 0, hsize2hbits(h)); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | #if LJ_HASJIT | 153 | #if LJ_HASJIT |
diff --git a/src/lj_tab.h b/src/lj_tab.h index f1712e45f..9822c3266 100644 --- a/src/lj_tab.h +++ b/src/lj_tab.h | |||
| @@ -53,7 +53,7 @@ static LJ_AINLINE Node *hashmask(const GCtab *t, uint32_t hash) | |||
| 53 | #define hsize2hbits(s) ((s) ? ((s)==1 ? 1 : 1+lj_fls((uint32_t)((s)-1))) : 0) | 53 | #define hsize2hbits(s) ((s) ? ((s)==1 ? 1 : 1+lj_fls((uint32_t)((s)-1))) : 0) |
| 54 | 54 | ||
| 55 | LJ_FUNCA GCtab *lj_tab_new(lua_State *L, uint32_t asize, uint32_t hbits); | 55 | LJ_FUNCA GCtab *lj_tab_new(lua_State *L, uint32_t asize, uint32_t hbits); |
| 56 | LJ_FUNC GCtab *lj_tab_new_ah(lua_State *L, int32_t a, int32_t h); | 56 | LJ_FUNC GCtab *lj_tab_new_ah(lua_State *L, uint32_t a, uint32_t h); |
| 57 | #if LJ_HASJIT | 57 | #if LJ_HASJIT |
| 58 | LJ_FUNC GCtab * LJ_FASTCALL lj_tab_new1(lua_State *L, uint32_t ahsize); | 58 | LJ_FUNC GCtab * LJ_FASTCALL lj_tab_new1(lua_State *L, uint32_t ahsize); |
| 59 | #endif | 59 | #endif |
