diff options
| author | Mike Pall <mike> | 2022-12-09 00:20:05 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2022-12-09 00:20:05 +0100 |
| commit | b2791179ef96d652d00d78d2a8780af690537f6a (patch) | |
| tree | 45acb535105791dbc8996a0777cbaf80bcef441a /src | |
| parent | cc96ab9d513582703f8663a8775a935b56db32b7 (diff) | |
| download | luajit-b2791179ef96d652d00d78d2a8780af690537f6a.tar.gz luajit-b2791179ef96d652d00d78d2a8780af690537f6a.tar.bz2 luajit-b2791179ef96d652d00d78d2a8780af690537f6a.zip | |
Correct fix for stack check when recording BC_VARG.
Reported by Yichun Zhang.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_record.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index f7552db0..dee53327 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
| @@ -1522,6 +1522,8 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults) | |||
| 1522 | } else if (dst + nresults > J->maxslot) { | 1522 | } else if (dst + nresults > J->maxslot) { |
| 1523 | J->maxslot = dst + (BCReg)nresults; | 1523 | J->maxslot = dst + (BCReg)nresults; |
| 1524 | } | 1524 | } |
| 1525 | if (J->baseslot + J->maxslot >= LJ_MAX_JSLOTS) | ||
| 1526 | lj_trace_err(J, LJ_TRERR_STACKOV); | ||
| 1525 | for (i = 0; i < nresults; i++) | 1527 | for (i = 0; i < nresults; i++) |
| 1526 | J->base[dst+i] = i < nvararg ? getslot(J, i - nvararg - 1) : TREF_NIL; | 1528 | J->base[dst+i] = i < nvararg ? getslot(J, i - nvararg - 1) : TREF_NIL; |
| 1527 | } else { /* Unknown number of varargs passed to trace. */ | 1529 | } else { /* Unknown number of varargs passed to trace. */ |
| @@ -1602,8 +1604,6 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults) | |||
| 1602 | lj_trace_err_info(J, LJ_TRERR_NYIBC); | 1604 | lj_trace_err_info(J, LJ_TRERR_NYIBC); |
| 1603 | } | 1605 | } |
| 1604 | } | 1606 | } |
| 1605 | if (J->baseslot + J->maxslot >= LJ_MAX_JSLOTS) | ||
| 1606 | lj_trace_err(J, LJ_TRERR_STACKOV); | ||
| 1607 | } | 1607 | } |
| 1608 | 1608 | ||
| 1609 | /* -- Record allocations -------------------------------------------------- */ | 1609 | /* -- Record allocations -------------------------------------------------- */ |
