]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Avoid out-of-range PC for stack overflow error from snapshot restore.
authorMike Pall <mike>
Thu, 24 Jul 2025 13:35:56 +0000 (15:35 +0200)
committerMike Pall <mike>
Thu, 24 Jul 2025 13:35:56 +0000 (15:35 +0200)
Reported by Sergey Kaplun. #1369

src/lj_debug.c

index a639cddf8f27e8cac358bde414f949af7f2f9d37..f340964917dbc11558bf99a196036ac9bc599d0b 100644 (file)
@@ -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));