From f5d5fea5382bc8cfb057a7072efbab01ed99b67b Mon Sep 17 00:00:00 2001 From: doujiang24 Date: Sun, 13 Jun 2021 19:28:08 +0800 Subject: [PATCH] bugfix: lua stack is broken when trace abort during recording nyi stitch. --- src/lj_ffrecord.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index d050d12d..ad080e3e 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c @@ -107,6 +107,11 @@ static void recff_stitch(jit_State *J) const BCIns *pc = frame_pc(base-1); TValue *pframe = frame_prevl(base-1); + MSize maxsnap = (MSize)J->param[JIT_P_maxsnap]; + MSize nsnap = J->cur.nsnap; + if (nsnap >= maxsnap) + lj_trace_err_info(J, LJ_TRERR_SNAPOV); + /* Move func + args up in Lua stack and insert continuation. */ memmove(&base[1], &base[-1-LJ_FR2], sizeof(TValue)*nslot); setframe_ftsz(nframe, ((char *)nframe - (char *)pframe) + FRAME_CONT);