浏览代码

Avoid out-of-range PC for stack overflow error from snapshot restore.

Reported by Sergey Kaplun. #1369
Mike Pall 1 月之前
父节点
当前提交
e3fa3c48d8
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      src/lj_debug.c

+ 1 - 0
src/lj_debug.c

@@ -101,6 +101,7 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
   pt = funcproto(fn);
   pos = proto_bcpos(pt, ins) - 1;
 #if LJ_HASJIT
+  if (pos == NO_BCPOS) return 1;  /* Pretend it's the first bytecode. */
   if (pos > pt->sizebc) {  /* Undo the effects of lj_trace_exit for JLOOP. */
     if (bc_isret(bc_op(ins[-1]))) {
       GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins));