mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Avoid conflict between 64 bit lightuserdata and ITERN key.
Reported by XmiliaH.
This commit is contained in:
parent
3f9389edc6
commit
16d38a4b21
@ -47,9 +47,10 @@ void *lj_lightud_intern(lua_State *L, void *p)
|
|||||||
if (segmap[seg] == up) /* Fast path. */
|
if (segmap[seg] == up) /* Fast path. */
|
||||||
return (void *)(((uint64_t)seg << LJ_LIGHTUD_BITS_LO) | lightudlo(u));
|
return (void *)(((uint64_t)seg << LJ_LIGHTUD_BITS_LO) | lightudlo(u));
|
||||||
segnum++;
|
segnum++;
|
||||||
|
/* Leave last segment unused to avoid clash with ITERN key. */
|
||||||
|
if (segnum >= (1 << LJ_LIGHTUD_BITS_SEG)-1) lj_err_msg(L, LJ_ERR_BADLU);
|
||||||
}
|
}
|
||||||
if (!((segnum-1) & segnum) && segnum != 1) {
|
if (!((segnum-1) & segnum) && segnum != 1) {
|
||||||
if (segnum >= (1 << LJ_LIGHTUD_BITS_SEG)) lj_err_msg(L, LJ_ERR_BADLU);
|
|
||||||
lj_mem_reallocvec(L, segmap, segnum, segnum ? 2*segnum : 2u, uint32_t);
|
lj_mem_reallocvec(L, segmap, segnum, segnum ? 2*segnum : 2u, uint32_t);
|
||||||
setmref(g->gc.lightudseg, segmap);
|
setmref(g->gc.lightudseg, segmap);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user