Skip to content

Commit 6ca5801

Browse files
author
Mike Pall
committed
Avoid out-of-range number of results when compiling select(k, ...).
The interpreter will throw and abort the trace, anyway.
1 parent 44bd743 commit 6ca5801

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lj_ffrecord.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ static void LJ_FASTCALL recff_select(jit_State *J, RecordFFData *rd)
256256
ptrdiff_t n = (ptrdiff_t)J->maxslot;
257257
if (start < 0) start += n;
258258
else if (start > n) start = n;
259-
rd->nres = n - start;
260259
if (start >= 1) {
261260
ptrdiff_t i;
261+
rd->nres = n - start;
262262
for (i = 0; i < n - start; i++)
263263
J->base[i] = J->base[start+i];
264264
} /* else: Interpreter will throw. */

0 commit comments

Comments
 (0)