Browse Source

Prevent compile of __concat with tailcall to fast function.

E.g. __concat = function() return setmetatable(...) end
Reported by Fezile Manana.
Mike Pall 4 years ago
parent
commit
75ee3a6159
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/lj_record.c

+ 3 - 0
src/lj_record.c

@@ -919,6 +919,9 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
       TRef tr = gotresults ? J->base[cbase+rbase] : TREF_NIL;
       if (bslot != J->maxslot) {  /* Concatenate the remainder. */
 	TValue *b = J->L->base, save;  /* Simulate lower frame and result. */
+	/* Can't handle MM_concat + CALLT + fast func side-effects. */
+	if (J->postproc != LJ_POST_NONE)
+	  lj_trace_err(J, LJ_TRERR_NYIRETL);
 	J->base[J->maxslot] = tr;
 	copyTV(J->L, &save, b-(2<<LJ_FR2));
 	if (gotresults)