diff options
author | Mike Pall <mike> | 2020-04-28 17:54:03 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-04-28 17:54:03 +0200 |
commit | 99d1268823914d0c1f46df0e85bf8fce50292252 (patch) | |
tree | 54f1d3d11dfe7760b7693a11b505ad4f7e461250 /src | |
parent | f133649ced961a6af920be89d646582ed7623424 (diff) | |
parent | 179cf2eb84fef2b9a524469c3c8cc49363b8fb10 (diff) | |
download | luajit-99d1268823914d0c1f46df0e85bf8fce50292252.tar.gz luajit-99d1268823914d0c1f46df0e85bf8fce50292252.tar.bz2 luajit-99d1268823914d0c1f46df0e85bf8fce50292252.zip |
Merge branch 'master' into v2.1
Diffstat (limited to '')
-rw-r--r-- | src/lib_base.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib_base.c b/src/lib_base.c index 54e9e2b0..8c1e98a6 100644 --- a/src/lib_base.c +++ b/src/lib_base.c | |||
@@ -224,9 +224,11 @@ LJLIB_CF(unpack) | |||
224 | int32_t n, i = lj_lib_optint(L, 2, 1); | 224 | int32_t n, i = lj_lib_optint(L, 2, 1); |
225 | int32_t e = (L->base+3-1 < L->top && !tvisnil(L->base+3-1)) ? | 225 | int32_t e = (L->base+3-1 < L->top && !tvisnil(L->base+3-1)) ? |
226 | lj_lib_checkint(L, 3) : (int32_t)lj_tab_len(t); | 226 | lj_lib_checkint(L, 3) : (int32_t)lj_tab_len(t); |
227 | uint32_t nu; | ||
227 | if (i > e) return 0; | 228 | if (i > e) return 0; |
228 | n = e - i + 1; | 229 | nu = (uint32_t)e - (uint32_t)i; |
229 | if (n <= 0 || !lua_checkstack(L, n)) | 230 | n = (int32_t)(nu+1); |
231 | if (nu >= LUAI_MAXCSTACK || !lua_checkstack(L, n)) | ||
230 | lj_err_caller(L, LJ_ERR_UNPACK); | 232 | lj_err_caller(L, LJ_ERR_UNPACK); |
231 | do { | 233 | do { |
232 | cTValue *tv = lj_tab_getint(t, i); | 234 | cTValue *tv = lj_tab_getint(t, i); |