From 5ca3897c4f5e0a35293838c80b7e4661d0b266ad Mon Sep 17 00:00:00 2001 From: XmiliaH Date: Thu, 31 Mar 2022 15:32:23 +0200 Subject: [PATCH] Itern special key should return null as userdata ptr --- src/lj_obj.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lj_obj.h b/src/lj_obj.h index 0a63fddf..fa7d02c2 100644 --- a/src/lj_obj.h +++ b/src/lj_obj.h @@ -845,6 +845,7 @@ static LJ_AINLINE void *lightudV(global_State *g, cTValue *o) uint64_t seg = lightudseg(u); uint32_t *segmap = mref(g->gc.lightudseg, uint32_t); lj_assertG(tvislightud(o), "lightuserdata expected"); + if (seg == (1 << LJ_LIGHTUD_BITS_SEG)-1) return NULL; lj_assertG(seg <= g->gc.lightudnum, "bad lightuserdata segment %d", seg); return (void *)(((uint64_t)segmap[seg] << 32) | lightudlo(u)); }