Skip to content

Commit 20aea93

Browse files
author
Mike Pall
committed
Fix assertion for LJ_KEYINDEX.
Thanks to XmiliaH.
1 parent 1cdff19 commit 20aea93

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lj_obj.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ static LJ_AINLINE void *lightudV(global_State *g, cTValue *o)
845845
uint64_t seg = lightudseg(u);
846846
uint32_t *segmap = mref(g->gc.lightudseg, uint32_t);
847847
lj_assertG(tvislightud(o), "lightuserdata expected");
848+
if (seg == (1 << LJ_LIGHTUD_BITS_SEG)-1) return NULL;
848849
lj_assertG(seg <= g->gc.lightudnum, "bad lightuserdata segment %d", seg);
849850
return (void *)(((uint64_t)segmap[seg] << 32) | lightudlo(u));
850851
}

0 commit comments

Comments
 (0)