diff options
author | Mike Pall <mike> | 2022-11-27 15:25:32 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2022-11-27 15:25:32 +0100 |
commit | 1d75cd4d7be638babe6d4e47bf73ea05fc65d81c (patch) | |
tree | aedb29bd2af77a151e950511ebe1eb457b23010a | |
parent | 46aa45dcbd9f3843503ddf3e00f8dda89eac6789 (diff) | |
download | luajit-1d75cd4d7be638babe6d4e47bf73ea05fc65d81c.tar.gz luajit-1d75cd4d7be638babe6d4e47bf73ea05fc65d81c.tar.bz2 luajit-1d75cd4d7be638babe6d4e47bf73ea05fc65d81c.zip |
Avoid assertion in case of stack overflow from stitched trace.
Reported by Sergey Bronnikov. Fixed by Sergey Kaplun.
-rw-r--r-- | src/lj_debug.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lj_debug.c b/src/lj_debug.c index 112f5358..ca893153 100644 --- a/src/lj_debug.c +++ b/src/lj_debug.c | |||
@@ -101,9 +101,12 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) | |||
101 | pos = proto_bcpos(pt, ins) - 1; | 101 | pos = proto_bcpos(pt, ins) - 1; |
102 | #if LJ_HASJIT | 102 | #if LJ_HASJIT |
103 | if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */ | 103 | if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */ |
104 | GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins)); | 104 | if (bc_isret(bc_op(ins[-1]))) { |
105 | lj_assertL(bc_isret(bc_op(ins[-1])), "return bytecode expected"); | 105 | GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins)); |
106 | pos = proto_bcpos(pt, mref(T->startpc, const BCIns)); | 106 | pos = proto_bcpos(pt, mref(T->startpc, const BCIns)); |
107 | } else { | ||
108 | pos = NO_BCPOS; /* Punt in case of stack overflow for stitched trace. */ | ||
109 | } | ||
107 | } | 110 | } |
108 | #endif | 111 | #endif |
109 | return pos; | 112 | return pos; |