Compare commits

..

No commits in common. "rawhide" and "f27" have entirely different histories.
rawhide ... f27

23 changed files with 62 additions and 1476 deletions

12
.gitignore vendored
View File

@ -13,15 +13,3 @@ lua-5.1.4/
/lua-5.3.3-tests.tar.gz
/lua-5.3.4.tar.gz
/lua-5.3.4-tests.tar.gz
/lua-5.3.5.tar.gz
/lua-5.4.0.tar.gz
/lua-5.4.0-tests.tar.gz
/lua-5.4.1-tests.tar.gz
/lua-5.4.1.tar.gz
/lua-5.4.2.tar.gz
/lua-5.4.2-tests.tar.gz
/lua-5.4.3.tar.gz
/lua-5.4.3-tests.tar.gz
/lua-5.4.4.tar.gz
/lua-5.4.4-tests.tar.gz
/lua-5.3.6.tar.gz

View File

@ -1,140 +0,0 @@
From 196bb94d66e727e0aec053a0276c3ad701500762 Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 25 May 2022 17:41:39 -0300
Subject: [PATCH] Bug: 'lua_settop' may use an invalid pointer to stack
---
lapi.c | 5 ++---
ldo.c | 12 ++++++------
lfunc.c | 5 +++--
lfunc.h | 2 +-
testes/locals.lua | 22 ++++++++++++++++++++++
5 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/lapi.c b/lapi.c
index 352a385a3..5833c7b0a 100644
--- a/src/lapi.c
+++ b/src/lapi.c
@@ -197,7 +197,7 @@ LUA_API void lua_settop (lua_State *L, int idx) {
newtop = L->top + diff;
if (diff < 0 && L->tbclist >= newtop) {
lua_assert(hastocloseCfunc(ci->nresults));
- luaF_close(L, newtop, CLOSEKTOP, 0);
+ newtop = luaF_close(L, newtop, CLOSEKTOP, 0);
}
L->top = newtop; /* correct top only after closing any upvalue */
lua_unlock(L);
@@ -210,8 +210,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) {
level = index2stack(L, idx);
api_check(L, hastocloseCfunc(L->ci->nresults) && L->tbclist == level,
"no variable to close at given level");
- luaF_close(L, level, CLOSEKTOP, 0);
- level = index2stack(L, idx); /* stack may be moved */
+ level = luaF_close(L, level, CLOSEKTOP, 0);
setnilvalue(s2v(level));
lua_unlock(L);
}
diff --git a/ldo.c b/ldo.c
index 5aa6d59d4..13498905f 100644
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -430,14 +430,15 @@ l_sinline void moveresults (lua_State *L, StkId res, int nres, int wanted) {
break;
default: /* two/more results and/or to-be-closed variables */
if (hastocloseCfunc(wanted)) { /* to-be-closed variables? */
- ptrdiff_t savedres = savestack(L, res);
L->ci->callstatus |= CIST_CLSRET; /* in case of yields */
L->ci->u2.nres = nres;
- luaF_close(L, res, CLOSEKTOP, 1);
+ res = luaF_close(L, res, CLOSEKTOP, 1);
L->ci->callstatus &= ~CIST_CLSRET;
- if (L->hookmask) /* if needed, call hook after '__close's */
+ if (L->hookmask) { /* if needed, call hook after '__close's */
+ ptrdiff_t savedres = savestack(L, res);
rethook(L, L->ci, nres);
- res = restorestack(L, savedres); /* close and hook can move stack */
+ res = restorestack(L, savedres); /* hook can move stack */
+ }
wanted = decodeNresults(wanted);
if (wanted == LUA_MULTRET)
wanted = nres; /* we want all results */
@@ -654,8 +655,7 @@ static int finishpcallk (lua_State *L, CallInfo *ci) {
else { /* error */
StkId func = restorestack(L, ci->u2.funcidx);
L->allowhook = getoah(ci->callstatus); /* restore 'allowhook' */
- luaF_close(L, func, status, 1); /* can yield or raise an error */
- func = restorestack(L, ci->u2.funcidx); /* stack may be moved */
+ func = luaF_close(L, func, status, 1); /* can yield or raise an error */
luaD_seterrorobj(L, status, func);
luaD_shrinkstack(L); /* restore stack size in case of overflow */
setcistrecst(ci, LUA_OK); /* clear original status */
diff --git a/lfunc.c b/lfunc.c
index f5889a21d..3ed65de2b 100644
--- a/src/lfunc.c
+++ b/src/lfunc.c
@@ -223,9 +223,9 @@ static void poptbclist (lua_State *L) {
/*
** Close all upvalues and to-be-closed variables up to the given stack
-** level.
+** level. Return restored 'level'.
*/
-void luaF_close (lua_State *L, StkId level, int status, int yy) {
+StkId luaF_close (lua_State *L, StkId level, int status, int yy) {
ptrdiff_t levelrel = savestack(L, level);
luaF_closeupval(L, level); /* first, close the upvalues */
while (L->tbclist >= level) { /* traverse tbc's down to that level */
@@ -234,6 +234,7 @@ void luaF_close (lua_State *L, StkId level, int status, int yy) {
prepcallclosemth(L, tbc, status, yy); /* close variable */
level = restorestack(L, levelrel);
}
+ return level;
}
diff --git a/lfunc.h b/lfunc.h
index dc1cebccd..3d296971e 100644
--- a/src/lfunc.h
+++ b/src/lfunc.h
@@ -54,7 +54,7 @@ LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level);
LUAI_FUNC void luaF_closeupval (lua_State *L, StkId level);
-LUAI_FUNC void luaF_close (lua_State *L, StkId level, int status, int yy);
+LUAI_FUNC StkId luaF_close (lua_State *L, StkId level, int status, int yy);
LUAI_FUNC void luaF_unlinkupval (UpVal *uv);
LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
diff --git a/testes/locals.lua b/testes/locals.lua
index 62a88df57..ddb75054f 100644
--- a/lua-5.4.4-tests/locals.lua
+++ b/lua-5.4.4-tests/locals.lua
@@ -592,6 +592,28 @@ end
if rawget(_G, "T") then
+ do
+ -- bug in 5.4.3
+ -- 'lua_settop' may use a pointer to stack invalidated by 'luaF_close'
+
+ -- reduce stack size
+ collectgarbage(); collectgarbage(); collectgarbage()
+
+ -- force a stack reallocation
+ local function loop (n)
+ if n < 400 then loop(n + 1) end
+ end
+
+ -- close metamethod will reallocate the stack
+ local o = setmetatable({}, {__close = function () loop(0) end})
+
+ local script = [[toclose 2; settop 1; return 1]]
+
+ assert(T.testC(script, o) == script)
+
+ end
+
+
-- memory error inside closing function
local function foo ()
local y <close> = func2close(function () T.alloccount() end)

View File

@ -1,43 +0,0 @@
From 1f3c6f4534c6411313361697d98d1145a1f030fa Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 15 Feb 2022 12:28:46 -0300
Subject: [PATCH] Bug: Lua can generate wrong code when _ENV is <const>
---
lparser.c | 1 +
testes/attrib.lua | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/lparser.c b/lparser.c
index 3abe3d751..a5cd55257 100644
--- a/src/lparser.c
+++ b/src/lparser.c
@@ -468,6 +468,7 @@ static void singlevar (LexState *ls, expdesc *var) {
expdesc key;
singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
lua_assert(var->k != VVOID); /* this one must exist */
+ luaK_exp2anyregup(fs, var); /* but could be a constant */
codestring(&key, varname); /* key is variable name */
luaK_indexed(fs, var, &key); /* env[varname] */
}
diff --git a/testes/attrib.lua b/testes/attrib.lua
index b1076c768..83821c069 100644
--- lua-5.4.4/lua-5.4.4-tests/attrib.lua
+++ lua-5.4.4/lua-5.4.4-tests/attrib.lua
@@ -434,6 +434,16 @@ a.aVeryLongName012345678901234567890123456789012345678901234567890123456789 ==
10)
+do
+ -- _ENV constant
+ local function foo ()
+ local _ENV <const> = 11
+ X = "hi"
+ end
+ local st, msg = pcall(foo)
+ assert(not st and string.find(msg, "number"))
+end
+
-- test of large float/integer indices

View File

@ -1,94 +0,0 @@
From 25b143dd34fb587d1e35290c4b25bc08954800e2 Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 7 Feb 2022 10:16:35 -0300
Subject: [PATCH] Bug: lua.c assumes that argv has at least one element
---
lua.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/lua.c b/lua.c
index 0f1900444..7f7dc2b22 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -177,10 +177,11 @@ static void print_version (void) {
** to the script (everything after 'script') go to positive indices;
** other arguments (before the script name) go to negative indices.
** If there is no script name, assume interpreter's name as base.
+** (If there is no interpreter's name either, 'script' is -1, so
+** table sizes are zero.)
*/
static void createargtable (lua_State *L, char **argv, int argc, int script) {
int i, narg;
- if (script == argc) script = 0; /* no script name? */
narg = argc - (script + 1); /* number of positive indices */
lua_createtable(L, narg, script + 1);
for (i = 0; i < argc; i++) {
@@ -268,14 +269,23 @@ static int handle_script (lua_State *L, char **argv) {
/*
** Traverses all arguments from 'argv', returning a mask with those
-** needed before running any Lua code (or an error code if it finds
-** any invalid argument). 'first' returns the first not-handled argument
-** (either the script name or a bad argument in case of error).
+** needed before running any Lua code or an error code if it finds any
+** invalid argument. In case of error, 'first' is the index of the bad
+** argument. Otherwise, 'first' is -1 if there is no program name,
+** 0 if there is no script name, or the index of the script name.
*/
static int collectargs (char **argv, int *first) {
int args = 0;
int i;
- for (i = 1; argv[i] != NULL; i++) {
+ if (argv[0] != NULL) { /* is there a program name? */
+ if (argv[0][0]) /* not empty? */
+ progname = argv[0]; /* save it */
+ }
+ else { /* no program name */
+ *first = -1;
+ return 0;
+ }
+ for (i = 1; argv[i] != NULL; i++) { /* handle arguments */
*first = i;
if (argv[i][0] != '-') /* not an option? */
return args; /* stop handling options */
@@ -316,7 +326,7 @@ static int collectargs (char **argv, int *first) {
return has_error;
}
}
- *first = i; /* no script name */
+ *first = 0; /* no script name */
return args;
}
@@ -609,8 +619,8 @@ static int pmain (lua_State *L) {
char **argv = (char **)lua_touserdata(L, 2);
int script;
int args = collectargs(argv, &script);
+ int optlim = (script > 0) ? script : argc; /* first argv not an option */
luaL_checkversion(L); /* check that interpreter has correct version */
- if (argv[0] && argv[0][0]) progname = argv[0];
if (args == has_error) { /* bad arg? */
print_usage(argv[script]); /* 'script' has index of bad arg. */
return 0;
@@ -628,14 +638,15 @@ static int pmain (lua_State *L) {
if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */
return 0; /* error running LUA_INIT */
}
- if (!runargs(L, argv, script)) /* execute arguments -e and -l */
+ if (!runargs(L, argv, optlim)) /* execute arguments -e and -l */
return 0; /* something failed */
- if (script < argc && /* execute main script (if there is one) */
- handle_script(L, argv + script) != LUA_OK)
- return 0;
+ if (script > 0) { /* execute main script (if there is one) */
+ if (handle_script(L, argv + script) != LUA_OK)
+ return 0; /* interrupt in case of error */
+ }
if (args & has_i) /* -i option? */
doREPL(L); /* do read-eval-print loop */
- else if (script == argc && !(args & (has_e | has_v))) { /* no arguments? */
+ else if (script < 1 && !(args & (has_e | has_v))) { /* no active option? */
if (lua_stdin_is_tty()) { /* running in interactive mode? */
print_version();
doREPL(L); /* do read-eval-print loop */

View File

@ -1,59 +0,0 @@
From 42d40581dd919fb134c07027ca1ce0844c670daf Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 20 May 2022 13:14:33 -0300
Subject: [PATCH] Save stack space while handling errors
Because error handling (luaG_errormsg) uses slots from EXTRA_STACK,
and some errors can recur (e.g., string overflow while creating an
error message in 'luaG_runerror', or a C-stack overflow before calling
the message handler), the code should use stack slots with parsimony.
This commit fixes the bug "Lua-stack overflow when C stack overflows
while handling an error".
---
ldebug.c | 5 ++++-
lvm.c | 6 ++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/ldebug.c b/ldebug.c
index a716d95e2..fa15eaf68 100644
--- a/src/ldebug.c
+++ b/src/ldebug.c
@@ -824,8 +824,11 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
va_end(argp);
- if (isLua(ci)) /* if Lua function, add source:line information */
+ if (isLua(ci)) { /* if Lua function, add source:line information */
luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci));
+ setobjs2s(L, L->top - 2, L->top - 1); /* remove 'msg' from the stack */
+ L->top--;
+ }
luaG_errormsg(L);
}
diff --git a/lvm.c b/lvm.c
index e8c2e9627..cd992aada 100644
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -656,8 +656,10 @@ void luaV_concat (lua_State *L, int total) {
/* collect total length and number of strings */
for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) {
size_t l = vslen(s2v(top - n - 1));
- if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl))
+ if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl)) {
+ L->top = top - total; /* pop strings to avoid wasting stack */
luaG_runerror(L, "string length overflow");
+ }
tl += l;
}
if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */
@@ -672,7 +674,7 @@ void luaV_concat (lua_State *L, int total) {
setsvalue2s(L, top - n, ts); /* create result */
}
total -= n-1; /* got 'n' strings to create 1 new */
- L->top -= n-1; /* popped 'n' strings and pushed one */
+ L->top = top - (n - 1); /* popped 'n' strings and pushed one */
} while (total > 1); /* repeat until only 1 result left */
}

View File

@ -1,22 +0,0 @@
--- a/src/lapi.c
+++ b/src/lapi.c
@@ -1285,14 +1285,14 @@ LUA_API void *lua_upvalueid (lua_State *
LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,
int fidx2, int n2) {
- LClosure *f1;
- UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
+ UpVal **up1 = getupvalref(L, fidx1, n1, NULL); /* the last parameter not needed */
UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
+ if (*up1 == *up2) return; /* Already joined */
+ (*up2)->refcount++;
+ if (upisopen(*up2)) (*up2)->u.open.touched = 1;
+ luaC_upvalbarrier(L, *up2);
luaC_upvdeccount(L, *up1);
*up1 = *up2;
- (*up1)->refcount++;
- if (upisopen(*up1)) (*up1)->u.open.touched = 1;
- luaC_upvalbarrier(L, *up1);
}

View File

@ -1,123 +0,0 @@
From c764ca71a639f5585b5f466bea25dc42b855a4b0 Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 25 Apr 2022 14:42:51 -0300
Subject: [PATCH] Bug: Wrong code generation in bitwise operations
---
lcode.c | 16 ++++++++++------
ltests.h | 7 +++++++
testes/constructs.lua | 25 +++++++++++++++++++++++++
3 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/lcode.c b/lcode.c
index 06425a1db..cb724a090 100644
--- a/src/lcode.c
+++ b/src/lcode.c
@@ -1391,7 +1391,10 @@ static void finishbinexpval (FuncState *fs, expdesc *e1, expdesc *e2,
*/
static void codebinexpval (FuncState *fs, OpCode op,
expdesc *e1, expdesc *e2, int line) {
- int v2 = luaK_exp2anyreg(fs, e2); /* both operands are in registers */
+ int v2 = luaK_exp2anyreg(fs, e2); /* make sure 'e2' is in a register */
+ /* 'e1' must be already in a register or it is a constant */
+ lua_assert((VNIL <= e1->k && e1->k <= VKSTR) ||
+ e1->k == VNONRELOC || e1->k == VRELOC);
lua_assert(OP_ADD <= op && op <= OP_SHR);
finishbinexpval(fs, e1, e2, op, v2, 0, line, OP_MMBIN,
cast(TMS, (op - OP_ADD) + TM_ADD));
@@ -1478,7 +1481,7 @@ static void codecommutative (FuncState *fs, BinOpr op,
/*
-** Code bitwise operations; they are all associative, so the function
+** Code bitwise operations; they are all commutative, so the function
** tries to put an integer constant as the 2nd operand (a K operand).
*/
static void codebitwise (FuncState *fs, BinOpr opr,
@@ -1486,11 +1489,11 @@ static void codebitwise (FuncState *fs, BinOpr opr,
int flip = 0;
int v2;
OpCode op;
- if (e1->k == VKINT && luaK_exp2RK(fs, e1)) {
+ if (e1->k == VKINT && luaK_exp2K(fs, e1)) {
swapexps(e1, e2); /* 'e2' will be the constant operand */
flip = 1;
}
- else if (!(e2->k == VKINT && luaK_exp2RK(fs, e2))) { /* no constants? */
+ else if (!(e2->k == VKINT && luaK_exp2K(fs, e2))) { /* no constants? */
op = cast(OpCode, opr + OP_ADD);
codebinexpval(fs, op, e1, e2, line); /* all-register opcodes */
return;
@@ -1551,7 +1554,7 @@ static void codeeq (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) {
op = OP_EQI;
r2 = im; /* immediate operand */
}
- else if (luaK_exp2RK(fs, e2)) { /* 1st expression is constant? */
+ else if (luaK_exp2RK(fs, e2)) { /* 2nd expression is constant? */
op = OP_EQK;
r2 = e2->u.info; /* constant index */
}
@@ -1611,7 +1614,8 @@ void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
case OPR_SHL: case OPR_SHR: {
if (!tonumeral(v, NULL))
luaK_exp2anyreg(fs, v);
- /* else keep numeral, which may be folded with 2nd operand */
+ /* else keep numeral, which may be folded or used as an immediate
+ operand */
break;
}
case OPR_EQ: case OPR_NE: {
diff --git a/ltests.h b/ltests.h
index cb3a0b480..ec520498b 100644
--- a/lua-5.4.4-tests/ltests/ltests.h
+++ b/lua-5.4.4-tests/ltests/ltests.h
@@ -125,6 +125,13 @@ LUA_API void *debug_realloc (void *ud, void *block,
#define LUAI_USER_ALIGNMENT_T union { char b[sizeof(void*) * 8]; }
+/*
+** This one is not compatible with tests for opcode optimizations,
+** as it blocks some optimizations
+#define MAXINDEXRK 0
+*/
+
+
/* make stack-overflow tests run faster */
#undef LUAI_MAXSTACK
#define LUAI_MAXSTACK 50000
diff --git a/testes/constructs.lua b/testes/constructs.lua
index a74a8c041..0d9ec92d7 100644
--- a/lua-5.4.4-tests/constructs.lua
+++ b/lua-5.4.4-tests/constructs.lua
@@ -103,6 +103,31 @@ do -- test old bug (first name could not be an `upvalue')
local a; function f(x) x={a=1}; x={x=1}; x={G=1} end
end
+
+do -- bug since 5.4.0
+ -- create code with a table using more than 256 constants
+ local code = {"local x = {"}
+ for i = 1, 257 do
+ code[#code + 1] = i .. ".1,"
+ end
+ code[#code + 1] = "};"
+ code = table.concat(code)
+
+ -- add "ret" to the end of that code and checks that
+ -- it produces the expected value "val"
+ local function check (ret, val)
+ local code = code .. ret
+ code = load(code)
+ assert(code() == val)
+ end
+
+ check("return (1 ~ (2 or 3))", 1 ~ 2)
+ check("return (1 | (2 or 3))", 1 | 2)
+ check("return (1 + (2 or 3))", 1 + 2)
+ check("return (1 << (2 or 3))", 1 << 2)
+end
+
+
function f (i)
if type(i) ~= 'number' then return i,'jojo'; end;
if i > 0 then return i, f(i-1); end;

View File

@ -1,23 +0,0 @@
diff -up lua-5.3.4/src/lapi.c.bug6 lua-5.3.4/src/lapi.c
--- lua-5.3.4/src/lapi.c.bug6 2018-02-13 10:18:59.386451581 -0500
+++ lua-5.3.4/src/lapi.c 2018-02-13 10:19:42.700575448 -0500
@@ -533,6 +533,7 @@ LUA_API void lua_pushcclosure (lua_State
lua_lock(L);
if (n == 0) {
setfvalue(L->top, fn);
+ api_incr_top(L);
}
else {
CClosure *cl;
@@ -546,9 +547,9 @@ LUA_API void lua_pushcclosure (lua_State
/* does not need barrier because closure is white */
}
setclCvalue(L, L->top, cl);
+ api_incr_top(L);
+ luaC_checkGC(L);
}
- api_incr_top(L);
- luaC_checkGC(L);
lua_unlock(L);
}

View File

@ -1,26 +0,0 @@
diff -up lua-5.3.5/src/ldebug.c.CVE-2020-24370 lua-5.3.5/src/ldebug.c
--- lua-5.3.5/src/ldebug.c.CVE-2020-24370 2020-08-19 13:37:17.075859557 -0400
+++ lua-5.3.5/src/ldebug.c 2020-08-19 13:38:53.117779244 -0400
@@ -133,10 +133,11 @@ static const char *upvalname (Proto *p,
static const char *findvararg (CallInfo *ci, int n, StkId *pos) {
int nparams = clLvalue(ci->func)->p->numparams;
- if (n >= cast_int(ci->u.l.base - ci->func) - nparams)
+ int nvararg = cast_int(ci->u.l.base - ci->func) - nparams;
+ if (n <= -nvararg)
return NULL; /* no such vararg */
else {
- *pos = ci->func + nparams + n;
+ *pos = ci->func + nparams - n;
return "(*vararg)"; /* generic name for any vararg */
}
}
@@ -148,7 +149,7 @@ static const char *findlocal (lua_State
StkId base;
if (isLua(ci)) {
if (n < 0) /* access to vararg values? */
- return findvararg(ci, -n, pos);
+ return findvararg(ci, n, pos);
else {
base = ci->u.l.base;
name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));

View File

@ -1,54 +0,0 @@
diff -up lua-5.3.5/src/lopcodes.c.luac-shared lua-5.3.5/src/lopcodes.c
--- lua-5.3.5/src/lopcodes.c.luac-shared 2019-10-23 15:36:44.487204487 -0400
+++ lua-5.3.5/src/lopcodes.c 2019-10-23 15:37:44.029960930 -0400
@@ -17,7 +17,7 @@
/* ORDER OP */
-LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
+LUA_API const char *const luaP_opnames[NUM_OPCODES+1] = {
"MOVE",
"LOADK",
"LOADKX",
@@ -71,7 +71,7 @@ LUAI_DDEF const char *const luaP_opnames
#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
-LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
+LUA_API const lu_byte luaP_opmodes[NUM_OPCODES] = {
/* T A B C mode opcode */
opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */
diff -up lua-5.3.5/src/lopcodes.h.luac-shared lua-5.3.5/src/lopcodes.h
--- lua-5.3.5/src/lopcodes.h.luac-shared 2019-10-23 15:37:52.982773948 -0400
+++ lua-5.3.5/src/lopcodes.h 2019-10-23 15:38:17.861254367 -0400
@@ -278,7 +278,7 @@ enum OpArgMask {
OpArgK /* argument is a constant or register/constant */
};
-LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
+LUA_API const lu_byte luaP_opmodes[NUM_OPCODES];
#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
@@ -287,7 +287,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM
#define testTMode(m) (luaP_opmodes[m] & (1 << 7))
-LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
+LUA_API const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
/* number of list items to accumulate before a SETLIST instruction */
diff -up lua-5.3.5/src/lundump.h.luac-shared lua-5.3.5/src/lundump.h
--- lua-5.3.5/src/lundump.h.luac-shared 2019-10-23 15:38:46.707651903 -0400
+++ lua-5.3.5/src/lundump.h 2019-10-23 15:39:07.044227180 -0400
@@ -26,7 +26,7 @@
LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
/* dump one chunk; from ldump.c */
-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
+LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
void* data, int strip);
#endif

View File

@ -1,192 +0,0 @@
diff -up lua-5.4.0-beta/configure.ac.autoxxx lua-5.4.0-beta/configure.ac
--- lua-5.4.0-beta/configure.ac.autoxxx 2019-10-23 15:03:13.296916443 -0400
+++ lua-5.4.0-beta/configure.ac 2019-10-23 15:03:13.296916443 -0400
@@ -0,0 +1,69 @@
+AC_PREREQ(2.59)
+AC_INIT([lua], [5.4.0], [https://bugzilla.redhat.com/], [lua-at], [http://www.lua.org])
+AC_SUBST([MAJOR_VERSION], [5.4])
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_SRCDIR([src/lapi.c])
+
+AM_INIT_AUTOMAKE([1.9 foreign])
+
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+AC_ARG_WITH(
+ [readline],
+ [AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])],
+ [use_readline=$withval],
+ [use_readline=yes]
+)
+
+LUA_LIBS="-lm"
+
+# Check for readline
+READLINE_DEFS="#undef LUA_USE_READLINE"
+if test "x$use_readline" == "xyes"; then
+ AC_CHECK_LIB([readline], [readline], [:], [use_readline=no], [-lncurses])
+ AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [use_readline=no])
+ if test "x$use_readline" == "xno"; then
+ AC_MSG_WARN([readline headers could not be found, disabling readline support])
+ else
+ READLINE_DEFS="#define LUA_USE_READLINE"
+ READLINE_LIBS="-lreadline -lncurses"
+ fi
+fi
+AC_SUBST(READLINE_DEFS)
+AC_SUBST(READLINE_LIBS)
+
+case "$host" in
+ *-mingw*) use_os=win32 ;;
+ *-darwin*) use_os=macosx ;;
+ *) use_os=posix ;;
+esac
+
+POSIX_DEFS="#undef LUA_USE_POSIX"
+LUA_DL_DEFS="#undef LUA_USE_DLOPEN"
+LUA_BUILD_AS_DLL_DEFS="#undef LUA_BUILD_AS_DLL"
+
+if test "x$use_os" == "xwin32"; then
+ LUA_BUILD_AS_DLL_DEFS="#define LUA_BUILD_AS_DLL"
+elif test "x$use_os" == "xmacosx"; then
+ POSIX_DEFS="#define LUA_USE_POSIX"
+ LUA_DL_DEFS="#define LUA_DL_DYLD"
+elif test "x$use_os" == "xposix"; then
+ POSIX_DEFS="#define LUA_USE_POSIX"
+ LUA_DL_DEFS="#define LUA_DL_DLOPEN"
+ LUA_LIBS="$LUA_LIBS -ldl"
+fi
+AC_SUBST(POSIX_DEFS)
+AC_SUBST(LUA_DL_DEFS)
+AC_SUBST(LUA_BUILD_AS_DLL_DEFS)
+
+AC_SUBST(LUA_LIBS)
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile
+ src/lua.pc
+ src/luaconf.h.template
+ doc/Makefile
+])
+AC_OUTPUT
diff -up lua-5.4.0-beta/doc/Makefile.am.autoxxx lua-5.4.0-beta/doc/Makefile.am
--- lua-5.4.0-beta/doc/Makefile.am.autoxxx 2019-10-23 15:03:13.296916443 -0400
+++ lua-5.4.0-beta/doc/Makefile.am 2019-10-23 15:03:13.296916443 -0400
@@ -0,0 +1,4 @@
+man1_MANS = lua.1 luac.1
+
+EXTRA_DIST = \
+ contents.html logo.gif lua.1 luac.1 lua.css manual.css manual.html osi-certified-72x60.png readme.html
diff -up lua-5.4.0-beta/Makefile.am.autoxxx lua-5.4.0-beta/Makefile.am
--- lua-5.4.0-beta/Makefile.am.autoxxx 2019-10-23 15:03:13.296916443 -0400
+++ lua-5.4.0-beta/Makefile.am 2019-10-23 15:03:13.296916443 -0400
@@ -0,0 +1,3 @@
+SUBDIRS = src doc
+
+EXTRA_DIST = README
diff -up lua-5.4.0-beta/src/.gitignore.autoxxx lua-5.4.0-beta/src/.gitignore
--- lua-5.4.0-beta/src/.gitignore.autoxxx 2019-10-23 15:03:13.297916423 -0400
+++ lua-5.4.0-beta/src/.gitignore 2019-10-23 15:03:13.296916443 -0400
@@ -0,0 +1,5 @@
+lua
+lua.pc
+luac
+luaconf.h
+luaconf.h.template
diff -up lua-5.4.0-beta/src/luaconf.h.template.in.autoxxx lua-5.4.0-beta/src/luaconf.h.template.in
--- lua-5.4.0-beta/src/luaconf.h.template.in.autoxxx 2019-09-30 19:52:16.000000000 -0400
+++ lua-5.4.0-beta/src/luaconf.h.template.in 2019-10-23 15:05:45.139817627 -0400
@@ -11,6 +11,11 @@
#include <limits.h>
#include <stddef.h>
+@POSIX_DEFS@
+@LUA_DL_DEFS@
+@LUA_BUILD_AS_DLL_DEFS@
+@READLINE_DEFS@
+
/*
** ===================================================================
@@ -227,9 +232,9 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
-#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
-#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
+#define LUA_ROOT "@prefix@/"
+#define LUA_LDIR "@pkgdatadir@/lua/" LUA_VDIR "/"
+#define LUA_CDIR "@libdir@/lua/" LUA_VDIR "/"
#if !defined(LUA_PATH_DEFAULT)
#define LUA_PATH_DEFAULT \
diff -up lua-5.4.0-beta/src/lua.pc.in.autoxxx lua-5.4.0-beta/src/lua.pc.in
--- lua-5.4.0-beta/src/lua.pc.in.autoxxx 2019-10-23 15:03:13.297916423 -0400
+++ lua-5.4.0-beta/src/lua.pc.in 2019-10-23 15:03:13.297916423 -0400
@@ -0,0 +1,13 @@
+V= @MAJOR_VERSION@
+R= @VERSION@
+prefix= @prefix@
+exec_prefix=${prefix}
+libdir= @libdir@
+includedir=${prefix}/include
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: ${R}
+Requires:
+Libs: -llua @LUA_LIBS@
+Cflags: -I${includedir}
diff -up lua-5.4.0-beta/src/Makefile.am.autoxxx lua-5.4.0-beta/src/Makefile.am
--- lua-5.4.0-beta/src/Makefile.am.autoxxx 2019-10-23 15:03:13.297916423 -0400
+++ lua-5.4.0-beta/src/Makefile.am 2019-10-23 15:03:13.297916423 -0400
@@ -0,0 +1,46 @@
+AM_CFLAGS = -Wall
+
+include_HEADERS = lua.h lualib.h lauxlib.h lua.hpp
+
+nodist_include_HEADERS = luaconf.h
+
+lib_LTLIBRARIES = liblua.la
+liblua_la_LDFLAGS = -release @MAJOR_VERSION@
+liblua_la_SOURCES = \
+ lapi.c lauxlib.c lbaselib.c lcode.c lcorolib.c lctype.c ldblib.c \
+ ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c \
+ loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c \
+ ltable.c ltablib.c ltm.c lundump.c lutf8lib.c lvm.c lzio.c \
+ lapi.h lcode.h lctype.h ldebug.h ldo.h lfunc.h lgc.h llex.h llimits.h \
+ lmem.h lobject.h lopcodes.h lparser.h lstate.h lstring.h ltable.h ltm.h \
+ lundump.h lvm.h lzio.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = lua.pc
+
+bin_PROGRAMS = lua luac
+
+lua_SOURCES = lua.c
+lua_LDADD = liblua.la @LUA_LIBS@ @READLINE_LIBS@
+lua_DEPENDENCIES = liblua.la
+
+luac_SOURCES = luac.c
+# Statically link liblua against luac since luac uses symbols not exported in liblua
+luac_LDADD = .libs/liblua.a @LUA_LIBS@
+luac_DEPENDENCIES = liblua.la
+
+EXTRA_DIST = luaconf.h.template
+BUILT_SOURCES = luaconf.h
+CLEANFILES = luaconf.h luaconf.h.template
+
+readline_defs = @READLINE_DEFS@
+
+edit = sed \
+ -e 's,%prefix%,$(prefix),g' \
+ -e 's,%lua_datadir%,$(datadir),g' \
+ -e 's,%lua_libdir%,$(libdir),g'
+
+luaconf.h : luaconf.h.template
+ rm -f $@ $@.tmp
+ $(edit) $< >$@.tmp
+ mv $@.tmp $@

View File

@ -1,11 +0,0 @@
diff -up lua-5.4.3/src/lstate.c.CVE-2021-44647 lua-5.4.3/src/lstate.c
--- lua-5.4.3/src/lstate.c.CVE-2021-44647 2022-01-24 11:15:00.851544455 -0500
+++ lua-5.4.3/src/lstate.c 2022-01-24 11:15:27.187694727 -0500
@@ -271,6 +271,7 @@ static void close_state (lua_State *L) {
if (!completestate(g)) /* closing a partially built state? */
luaC_freeallobjects(L); /* jucst collect its objects */
else { /* closing a fully built state */
+ L->ci = &L->base_ci; /* unwind CallInfo list */
luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */
luaC_freeallobjects(L); /* collect all objects */
luai_userstateclose(L);

View File

@ -1,261 +0,0 @@
diff -up lua-5.4.3/lua-5.4.3-tests/api.lua.bug10 lua-5.4.3/lua-5.4.3-tests/api.lua
--- lua-5.4.3/lua-5.4.3-tests/api.lua.bug10 2022-01-24 17:07:28.084973092 -0500
+++ lua-5.4.3/lua-5.4.3-tests/api.lua 2022-01-24 17:08:50.306551450 -0500
@@ -804,15 +804,14 @@ F = function (x)
d = nil
assert(debug.getmetatable(x).__gc == F)
assert(load("table.insert({}, {})"))() -- create more garbage
- collectgarbage() -- force a GC during GC
- assert(debug.getmetatable(x).__gc == F) -- previous GC did not mess this?
+ assert(not collectgarbage()) -- GC during GC (no op)
local dummy = {} -- create more garbage during GC
if A ~= nil then
assert(type(A) == "userdata")
assert(T.udataval(A) == B)
debug.getmetatable(A) -- just access it
end
- A = x -- ressucita userdata
+ A = x -- ressurect userdata
B = udval
return 1,2,3
end
diff -up lua-5.4.3/lua-5.4.3-tests/gc.lua.bug10 lua-5.4.3/lua-5.4.3-tests/gc.lua
--- lua-5.4.3/lua-5.4.3-tests/gc.lua.bug10 2022-01-24 17:08:57.241600231 -0500
+++ lua-5.4.3/lua-5.4.3-tests/gc.lua 2022-01-24 17:10:20.100183086 -0500
@@ -676,11 +676,13 @@ end
-- just to make sure
assert(collectgarbage'isrunning')
-do -- check that the collector is reentrant in incremental mode
+do -- check that the collector is not reentrant in incremental mode
+ local res = true
setmetatable({}, {__gc = function ()
- collectgarbage()
+ res = collectgarbage()
end})
collectgarbage()
+ assert(not res)
end
diff -up lua-5.4.3/src/lapi.c.bug10 lua-5.4.3/src/lapi.c
--- lua-5.4.3/src/lapi.c.bug10 2022-01-24 16:56:54.409515673 -0500
+++ lua-5.4.3/src/lapi.c 2022-01-24 16:59:36.136653287 -0500
@@ -1126,18 +1126,19 @@ LUA_API int lua_status (lua_State *L) {
LUA_API int lua_gc (lua_State *L, int what, ...) {
va_list argp;
int res = 0;
- global_State *g;
+ global_State *g = G(L);
+ if (g->gcstp & GCSTPGC) /* internal stop? */
+ return -1; /* all options are invalid when stopped */
lua_lock(L);
- g = G(L);
va_start(argp, what);
switch (what) {
case LUA_GCSTOP: {
- g->gcrunning = 0;
+ g->gcstp = GCSTPUSR; /* stopeed by the user */
break;
}
case LUA_GCRESTART: {
luaE_setdebt(g, 0);
- g->gcrunning = 1;
+ g->gcstp = 0; /* (GCSTPGC must be already zero here) */
break;
}
case LUA_GCCOLLECT: {
@@ -1156,8 +1157,8 @@ LUA_API int lua_gc (lua_State *L, int wh
case LUA_GCSTEP: {
int data = va_arg(argp, int);
l_mem debt = 1; /* =1 to signal that it did an actual step */
- lu_byte oldrunning = g->gcrunning;
- g->gcrunning = 1; /* allow GC to run */
+ lu_byte oldstp = g->gcstp;
+ g->gcstp = 0; /* allow GC to run (GCSTPGC must be zero here) */
if (data == 0) {
luaE_setdebt(g, 0); /* do a basic step */
luaC_step(L);
@@ -1167,7 +1168,7 @@ LUA_API int lua_gc (lua_State *L, int wh
luaE_setdebt(g, debt);
luaC_checkGC(L);
}
- g->gcrunning = oldrunning; /* restore previous state */
+ g->gcstp = oldstp; /* restore previous state */
if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */
res = 1; /* signal it */
break;
@@ -1185,7 +1186,7 @@ LUA_API int lua_gc (lua_State *L, int wh
break;
}
case LUA_GCISRUNNING: {
- res = g->gcrunning;
+ res = gcrunning(g);
break;
}
case LUA_GCGEN: {
diff -up lua-5.4.3/src/lbaselib.c.bug10 lua-5.4.3/src/lbaselib.c
--- lua-5.4.3/src/lbaselib.c.bug10 2022-01-24 16:59:43.337703940 -0500
+++ lua-5.4.3/src/lbaselib.c 2022-01-24 17:02:19.898805225 -0500
@@ -182,12 +182,20 @@ static int luaB_rawset (lua_State *L) {
static int pushmode (lua_State *L, int oldmode) {
- lua_pushstring(L, (oldmode == LUA_GCINC) ? "incremental"
- : "generational");
+ if (oldmode == -1)
+ luaL_pushfail(L); /* invalid call to 'lua_gc' */
+ else
+ lua_pushstring(L, (oldmode == LUA_GCINC) ? "incremental"
+ : "generational");
return 1;
}
+/*
+** check whether call to 'lua_gc' was valid (not inside a finalizer)
+*/
+#define checkvalres(res) { if (res == -1) break; }
+
static int luaB_collectgarbage (lua_State *L) {
static const char *const opts[] = {"stop", "restart", "collect",
"count", "step", "setpause", "setstepmul",
@@ -200,12 +208,14 @@ static int luaB_collectgarbage (lua_Stat
case LUA_GCCOUNT: {
int k = lua_gc(L, o);
int b = lua_gc(L, LUA_GCCOUNTB);
+ checkvalres(k);
lua_pushnumber(L, (lua_Number)k + ((lua_Number)b/1024));
return 1;
}
case LUA_GCSTEP: {
int step = (int)luaL_optinteger(L, 2, 0);
int res = lua_gc(L, o, step);
+ checkvalres(res);
lua_pushboolean(L, res);
return 1;
}
@@ -213,11 +223,13 @@ static int luaB_collectgarbage (lua_Stat
case LUA_GCSETSTEPMUL: {
int p = (int)luaL_optinteger(L, 2, 0);
int previous = lua_gc(L, o, p);
+ checkvalres(previous);
lua_pushinteger(L, previous);
return 1;
}
case LUA_GCISRUNNING: {
int res = lua_gc(L, o);
+ checkvalres(res);
lua_pushboolean(L, res);
return 1;
}
@@ -234,10 +246,13 @@ static int luaB_collectgarbage (lua_Stat
}
default: {
int res = lua_gc(L, o);
+ checkvalres(res);
lua_pushinteger(L, res);
return 1;
}
}
+ luaL_pushfail(L); /* invalid call (inside a finalizer) */
+ return 1;
}
diff -up lua-5.4.3/src/lgc.c.bug10 lua-5.4.3/src/lgc.c
--- lua-5.4.3/src/lgc.c.bug10 2022-01-24 17:02:30.231877910 -0500
+++ lua-5.4.3/src/lgc.c 2022-01-24 17:04:02.486526852 -0500
@@ -906,16 +906,16 @@ static void GCTM (lua_State *L) {
if (!notm(tm)) { /* is there a finalizer? */
int status;
lu_byte oldah = L->allowhook;
- int running = g->gcrunning;
+ int oldgcstp = g->gcstp;
+ g->gcstp = GCSTPGC; /* avoid GC steps */
L->allowhook = 0; /* stop debug hooks during GC metamethod */
- g->gcrunning = 0; /* avoid GC steps */
setobj2s(L, L->top++, tm); /* push finalizer... */
setobj2s(L, L->top++, &v); /* ... and its argument */
L->ci->callstatus |= CIST_FIN; /* will run a finalizer */
status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0);
L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */
L->allowhook = oldah; /* restore hooks */
- g->gcrunning = running; /* restore state */
+ g->gcstp = oldgcstp; /* restore state */
if (l_unlikely(status != LUA_OK)) { /* error while running __gc? */
luaE_warnerror(L, "__gc metamethod");
L->top--; /* pops error object */
@@ -1502,9 +1502,11 @@ static void deletelist (lua_State *L, GC
*/
void luaC_freeallobjects (lua_State *L) {
global_State *g = G(L);
+ g->gcstp = GCSTPGC;
luaC_changemode(L, KGC_INC);
separatetobefnz(g, 1); /* separate all objects with finalizers */
lua_assert(g->finobj == NULL);
+ g->gcstp = 0;
callallpendingfinalizers(L);
deletelist(L, g->allgc, obj2gco(g->mainthread));
deletelist(L, g->finobj, NULL);
@@ -1678,7 +1680,7 @@ static void incstep (lua_State *L, globa
void luaC_step (lua_State *L) {
global_State *g = G(L);
lua_assert(!g->gcemergency);
- if (g->gcrunning) { /* running? */
+ if (gcrunning(g)) { /* running? */
if(isdecGCmodegen(g))
genstep(L, g);
else
diff -up lua-5.4.3/src/lgc.h.bug10 lua-5.4.3/src/lgc.h
--- lua-5.4.3/src/lgc.h.bug10 2022-01-24 17:04:08.890571899 -0500
+++ lua-5.4.3/src/lgc.h 2022-01-24 17:04:41.260799595 -0500
@@ -148,6 +148,15 @@
*/
#define isdecGCmodegen(g) (g->gckind == KGC_GEN || g->lastatomic != 0)
+
+/*
+** Control when GC is running:
+*/
+#define GCSTPUSR 1 /* bit true when GC stopped by user */
+#define GCSTPGC 2 /* bit true when GC stopped by itself */
+#define gcrunning(g) ((g)->gcstp == 0)
+
+
/*
** Does one step of collection when debt becomes positive. 'pre'/'pos'
** allows some adjustments to be done only when needed. macro
diff -up lua-5.4.3/src/lstate.c.bug10 lua-5.4.3/src/lstate.c
--- lua-5.4.3/src/lstate.c.bug10 2022-01-24 17:04:51.775873561 -0500
+++ lua-5.4.3/src/lstate.c 2022-01-24 17:05:26.544118136 -0500
@@ -236,7 +236,7 @@ static void f_luaopen (lua_State *L, voi
luaS_init(L);
luaT_init(L);
luaX_init(L);
- g->gcrunning = 1; /* allow gc */
+ g->gcstp = 0; /* allow gc */
setnilvalue(&g->nilvalue); /* now state is complete */
luai_userstateopen(L);
}
@@ -373,7 +373,7 @@ LUA_API lua_State *lua_newstate (lua_All
g->ud_warn = NULL;
g->mainthread = L;
g->seed = luai_makeseed(L);
- g->gcrunning = 0; /* no GC while building state */
+ g->gcstp = GCSTPGC; /* no GC while building state */
g->strt.size = g->strt.nuse = 0;
g->strt.hash = NULL;
setnilvalue(&g->l_registry);
diff -up lua-5.4.3/src/lstate.h.bug10 lua-5.4.3/src/lstate.h
--- lua-5.4.3/src/lstate.h.bug10 2022-01-24 17:05:30.179143707 -0500
+++ lua-5.4.3/src/lstate.h 2022-01-24 17:07:05.577814767 -0500
@@ -263,7 +263,7 @@ typedef struct global_State {
lu_byte gcstopem; /* stops emergency collections */
lu_byte genminormul; /* control for minor generational collections */
lu_byte genmajormul; /* control for major generational collections */
- lu_byte gcrunning; /* true if GC is running */
+ lu_byte gcstp; /* control whether GC is running */
lu_byte gcemergency; /* true if this is an emergency collection */
lu_byte gcpause; /* size of pause between successive GCs */
lu_byte gcstepmul; /* GC "speed" */

View File

@ -1,32 +0,0 @@
diff -up lua-5.4.3/src/lvm.c.bug3 lua-5.4.3/src/lvm.c
--- lua-5.4.3/src/lvm.c.bug3 2021-04-28 13:27:54.025590350 -0400
+++ lua-5.4.3/src/lvm.c 2021-04-28 13:28:55.233614835 -0400
@@ -847,10 +847,19 @@ void luaV_finishOp (lua_State *L) {
luaV_concat(L, total); /* concat them (may yield again) */
break;
}
- case OP_CLOSE: case OP_RETURN: { /* yielded closing variables */
+ case OP_CLOSE: { /* yielded closing variables */
ci->u.l.savedpc--; /* repeat instruction to close other vars. */
break;
}
+ case OP_RETURN: { /* yielded closing variables */
+ StkId ra = base + GETARG_A(inst);
+ /* correct top to signal correct number of returns (in case the
+ return is "in top" */
+ L->top = ra + ci->u2.nres;
+ /* repeat instruction to close other vars. and complete the return */
+ ci->u.l.savedpc--;
+ break;
+ }
default: {
/* only these other opcodes can yield */
lua_assert(op == OP_TFORCALL || op == OP_CALL ||
@@ -1670,6 +1679,7 @@ void luaV_execute (lua_State *L, CallInf
n = cast_int(L->top - ra); /* get what is available */
savepc(ci);
if (TESTARG_k(i)) { /* may there be open upvalues? */
+ ci->u2.nres = n; /* save number of returns */
if (L->top < ci->top)
L->top = ci->top;
luaF_close(L, base, CLOSEKTOP, 1);

View File

@ -1,23 +0,0 @@
diff -up lua-5.4.3/lua-5.4.3-tests/locals.lua.bug4 lua-5.4.3/lua-5.4.3-tests/locals.lua
--- lua-5.4.3/lua-5.4.3-tests/locals.lua.bug4 2022-01-24 11:21:11.757660851 -0500
+++ lua-5.4.3/lua-5.4.3-tests/locals.lua 2022-01-24 11:21:34.088788271 -0500
@@ -187,6 +187,8 @@ do -- constants
checkro("y", "local x, y <const>, z = 10, 20, 30; x = 11; y = 12")
checkro("x", "local x <const>, y, z <const> = 10, 20, 30; x = 11")
checkro("z", "local x <const>, y, z <const> = 10, 20, 30; y = 10; z = 11")
+ checkro("foo", "local foo <const> = 10; function foo() end")
+ checkro("foo", "local foo <const> = {}; function foo() end")
checkro("z", [[
local a, z <const>, b = 10;
diff -up lua-5.4.3/src/lparser.c.bug4 lua-5.4.3/src/lparser.c
--- lua-5.4.3/src/lparser.c.bug4 2022-01-24 11:20:27.808410077 -0500
+++ lua-5.4.3/src/lparser.c 2022-01-24 11:20:49.592534377 -0500
@@ -1776,6 +1776,7 @@ static void funcstat (LexState *ls, int
luaX_next(ls); /* skip FUNCTION */
ismethod = funcname(ls, &v);
body(ls, &b, ismethod, line);
+ check_readonly(ls, &v);
luaK_storevar(ls->fs, &v, &b);
luaK_fixline(ls->fs, line); /* definition "happens" in the first line */
}

View File

@ -1,11 +0,0 @@
diff -up lua-5.4.3/src/lauxlib.c.bug5 lua-5.4.3/src/lauxlib.c
--- lua-5.4.3/src/lauxlib.c.bug5 2022-01-24 11:23:19.763391239 -0500
+++ lua-5.4.3/src/lauxlib.c 2022-01-24 11:23:52.554578345 -0500
@@ -881,6 +881,7 @@ LUALIB_API lua_Integer luaL_len (lua_Sta
LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
+ idx = lua_absindex(L,idx);
if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */
if (!lua_isstring(L, -1))
luaL_error(L, "'__tostring' must return a string");

View File

@ -1,12 +0,0 @@
diff -up lua-5.4.3/src/lvm.c.bug6 lua-5.4.3/src/lvm.c
--- lua-5.4.3/src/lvm.c.bug6 2022-01-24 11:25:20.620080850 -0500
+++ lua-5.4.3/src/lvm.c 2022-01-24 11:25:46.443228197 -0500
@@ -766,7 +766,7 @@ lua_Number luaV_modf (lua_State *L, lua_
/*
** Shift left operation. (Shift right just negates 'y'.)
*/
-#define luaV_shiftr(x,y) luaV_shiftl(x,-(y))
+#define luaV_shiftr(x,y) luaV_shiftl(x,intop(-, 0, y))
lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) {
if (y < 0) { /* shift right? */

View File

@ -1,50 +0,0 @@
diff -up lua-5.4.3/lua-5.4.3-tests/cstack.lua.bug7 lua-5.4.3/lua-5.4.3-tests/cstack.lua
--- lua-5.4.3/lua-5.4.3-tests/cstack.lua.bug7 2022-01-24 11:29:00.412334975 -0500
+++ lua-5.4.3/lua-5.4.3-tests/cstack.lua 2022-01-24 11:32:08.101405924 -0500
@@ -103,6 +103,20 @@ do
end
+do -- bug in 5.4.2
+ print("nesting coroutines running after recoverable errors")
+ local count = 0
+ local function foo()
+ count = count + 1
+ pcall(1) -- create an error
+ -- running now inside 'precover' ("protected recover")
+ coroutine.wrap(foo)() -- call another coroutine
+ end
+ checkerror("C stack overflow", foo)
+ print("final count: ", count)
+end
+
+
if T then
print("testing stack recovery")
local N = 0 -- trace number of calls
diff -up lua-5.4.3/src/ldo.c.bug7 lua-5.4.3/src/ldo.c
--- lua-5.4.3/src/ldo.c.bug7 2022-01-24 11:27:41.226883145 -0500
+++ lua-5.4.3/src/ldo.c 2022-01-24 11:28:45.374249175 -0500
@@ -728,11 +728,10 @@ static void resume (lua_State *L, void *
StkId firstArg = L->top - n; /* first argument */
CallInfo *ci = L->ci;
if (L->status == LUA_OK) /* starting a coroutine? */
- ccall(L, firstArg - 1, LUA_MULTRET, 1); /* just call its body */
+ ccall(L, firstArg - 1, LUA_MULTRET, 0); /* just call its body */
else { /* resuming from previous yield */
lua_assert(L->status == LUA_YIELD);
L->status = LUA_OK; /* mark that it is running (again) */
- luaE_incCstack(L); /* control the C stack */
if (isLua(ci)) { /* yielded inside a hook? */
L->top = firstArg; /* discard arguments */
luaV_execute(L, ci); /* just continue running Lua code */
@@ -783,6 +782,9 @@ LUA_API int lua_resume (lua_State *L, lu
else if (L->status != LUA_YIELD) /* ended with errors? */
return resume_error(L, "cannot resume dead coroutine", nargs);
L->nCcalls = (from) ? getCcalls(from) : 0;
+ if (getCcalls(L) >= LUAI_MAXCCALLS)
+ return resume_error(L, "C stack overflow", nargs);
+ L->nCcalls++;
luai_userstateresume(L, nargs);
api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);
status = luaD_rawrunprotected(L, resume, &nargs);

View File

@ -1,143 +0,0 @@
diff -up lua-5.4.3/lua-5.4.3-tests/coroutine.lua.bug8 lua-5.4.3/lua-5.4.3-tests/coroutine.lua
--- lua-5.4.3/lua-5.4.3-tests/coroutine.lua.bug8 2022-01-24 13:52:57.345650003 -0500
+++ lua-5.4.3/lua-5.4.3-tests/coroutine.lua 2022-01-24 13:55:46.679628140 -0500
@@ -137,11 +137,16 @@ do
local st, msg = coroutine.close(co)
assert(st and msg == nil)
+
-- cannot close the running coroutine
local st, msg = pcall(coroutine.close, coroutine.running())
assert(not st and string.find(msg, "running"))
local main = coroutine.running()
+ -- also ok to close it again
+ st, msg = coroutine.close(co)
+ assert(st and msg == nil)
+
-- cannot close a "normal" coroutine
;(coroutine.wrap(function ()
@@ -149,6 +154,22 @@ do
assert(not st and string.find(msg, "normal"))
end))()
+ -- cannot close a coroutine while closing it
+ do
+ local co
+ co = coroutine.create(
+ function()
+ local x <close> = func2close(function()
+ coroutine.close(co) -- try to close it again
+ end)
+ coroutine.yield(20)
+ end)
+ local st, msg = coroutine.resume(co)
+ assert(st and msg == 20)
+ st, msg = coroutine.close(co)
+ assert(not st and string.find(msg, "running coroutine"))
+ end
+
-- to-be-closed variables in coroutines
local X
@@ -158,6 +179,9 @@ do
assert(not st and msg == 100)
st, msg = coroutine.close(co)
assert(not st and msg == 100)
+ -- after closing, no more errors
+ st, msg = coroutine.close(co)
+ assert(st and msg == nil)
co = coroutine.create(function ()
local x <close> = func2close(function (self, err)
@@ -189,6 +213,9 @@ do
local st, msg = coroutine.close(co)
assert(st == false and coroutine.status(co) == "dead" and msg == 200)
assert(x == 200)
+ -- after closing, no more errors
+ st, msg = coroutine.close(co)
+ assert(st and msg == nil)
end
do
@@ -419,7 +446,7 @@ do
local X = false
A = coroutine.wrap(function()
- local _ <close> = setmetatable({}, {__close = function () X = true end})
+ local _ <close> = func2close(function () X = true end)
return pcall(A, 1)
end)
st, res = A()
@@ -427,6 +454,22 @@ do
end
+-- bug in 5.4.1
+do
+ -- coroutine ran close metamethods with invalid status during a
+ -- reset.
+ local co
+ co = coroutine.wrap(function()
+ local x <close> = func2close(function() return pcall(co) end)
+ error(111)
+ end)
+ local st, errobj = pcall(co)
+ assert(not st and errobj == 111)
+ st, errobj = pcall(co)
+ assert(not st and string.find(errobj, "dead coroutine"))
+end
+
+
-- attempt to resume 'normal' coroutine
local co1, co2
co1 = coroutine.create(function () return co2() end)
diff -up lua-5.4.3/src/lcorolib.c.bug8 lua-5.4.3/src/lcorolib.c
--- lua-5.4.3/src/lcorolib.c.bug8 2022-01-24 13:51:10.238031307 -0500
+++ lua-5.4.3/src/lcorolib.c 2022-01-24 13:51:58.951312692 -0500
@@ -78,7 +78,7 @@ static int luaB_auxwrap (lua_State *L) {
if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */
stat = lua_resetthread(co); /* close its tbc variables */
lua_assert(stat != LUA_OK);
- lua_xmove(co, L, 1); /* copy error message */
+ lua_xmove(co, L, 1); /* move error message to the caller */
}
if (stat != LUA_ERRMEM && /* not a memory error and ... */
lua_type(L, -1) == LUA_TSTRING) { /* ... error object is a string? */
@@ -179,7 +179,7 @@ static int luaB_close (lua_State *L) {
}
else {
lua_pushboolean(L, 0);
- lua_xmove(co, L, 1); /* copy error message */
+ lua_xmove(co, L, 1); /* move error message */
return 2;
}
}
diff -up lua-5.4.3/src/lstate.c.bug8 lua-5.4.3/src/lstate.c
--- lua-5.4.3/src/lstate.c.bug8 2022-01-24 13:52:07.581362543 -0500
+++ lua-5.4.3/src/lstate.c 2022-01-24 13:52:40.932555194 -0500
@@ -166,7 +166,7 @@ void luaE_checkcstack (lua_State *L) {
if (getCcalls(L) == LUAI_MAXCCALLS)
luaG_runerror(L, "C stack overflow");
else if (getCcalls(L) >= (LUAI_MAXCCALLS / 10 * 11))
- luaD_throw(L, LUA_ERRERR); /* error while handing stack error */
+ luaD_throw(L, LUA_ERRERR); /* error while handling stack error */
}
@@ -331,13 +331,13 @@ int luaE_resetthread (lua_State *L, int
ci->callstatus = CIST_C;
if (status == LUA_YIELD)
status = LUA_OK;
+ L->status = LUA_OK; /* so it can run __close metamethods */
status = luaD_closeprotected(L, 1, status);
if (status != LUA_OK) /* errors? */
luaD_seterrorobj(L, status, L->stack + 1);
else
L->top = L->stack + 1;
ci->top = L->top + LUA_MINSTACK;
- L->status = cast_byte(status);
luaD_reallocstack(L, cast_int(ci->top - L->stack), 0);
return status;
}

186
lua.spec
View File

@ -1,12 +1,10 @@
%global major_version 5.4
# Normally, this is the same as version, but... not always.
%global test_version 5.4.4
%global major_version 5.3
# If you are incrementing major_version, enable bootstrapping and adjust accordingly.
# Version should be the latest prior build. If you don't do this, RPM will break and
# everything will grind to a halt.
%global bootstrap 1
%global bootstrap_major_version 5.3
%global bootstrap_version %{bootstrap_major_version}.6
%global bootstrap 0
%global bootstrap_major_version 5.2
%global bootstrap_version %{bootstrap_major_version}.3
# Place rpm-macros into proper location.
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
@ -14,42 +12,40 @@
Name: lua
Version: %{major_version}.4
Release: 4%{?dist}
Release: 7%{?dist}
Summary: Powerful light-weight programming language
Group: Development/Languages
License: MIT
URL: https://www.lua.org/
Source0: https://www.lua.org/ftp/lua-%{version}.tar.gz
URL: http://www.lua.org/
Source0: http://www.lua.org/ftp/lua-%{version}.tar.gz
# copied from doc/readme.html on 2014-07-18
Source1: mit.txt
%if 0%{?bootstrap}
Source2: https://www.lua.org/ftp/lua-%{bootstrap_version}.tar.gz
Source2: http://www.lua.org/ftp/lua-%{bootstrap_version}.tar.gz
%endif
Source3: https://www.lua.org/tests/lua-%{test_version}-tests.tar.gz
Source3: http://www.lua.org/tests/lua-%{version}-tests.tar.gz
# multilib
Source4: luaconf.h
Patch0: %{name}-5.4.0-beta-autotoolize.patch
# rpm-macro
Source1000: macros.lua
Patch0: %{name}-5.3.0-autotoolize.patch
Patch1: %{name}-5.3.0-idsize.patch
#Patch2: %%{name}-5.3.0-luac-shared-link-fix.patch
Patch3: %{name}-5.2.2-configure-linux.patch
Patch4: %{name}-5.3.0-configure-compat-module.patch
%if 0%{?bootstrap}
Patch5: %{name}-5.3.0-autotoolize.patch
Patch6: %{name}-5.3.5-luac-shared-link-fix.patch
Patch5: %{name}-5.2.3-autotoolize.patch
Patch6: %{name}-5.2.2-idsize.patch
Patch7: %{name}-5.2.2-luac-shared-link-fix.patch
Patch8: %{name}-5.2.2-configure-compat-module.patch
%endif
# https://www.lua.org/bugs.html
# 5.4.4 Bug 1
Patch7: https://github.com/lua/lua/commit/25b143dd34fb587d1e35290c4b25bc08954800e2.patch
# 5.4.4 Bug 2
Patch8: https://github.com/lua/lua/commit/1f3c6f4534c6411313361697d98d1145a1f030fa.patch
# 5.4.4 Bug 3
Patch9: https://github.com/lua/lua/commit/c764ca71a639f5585b5f466bea25dc42b855a4b0.patch
# 5.4.4 Bug 4
Patch10: https://github.com/lua/lua/commit/42d40581dd919fb134c07027ca1ce0844c670daf.patch
# 5.4.4 Bug 5
Patch11: https://github.com/lua/lua/commit/196bb94d66e727e0aec053a0276c3ad701500762.patch
Patch9: lua-5.3.4-bug1.patch
Patch10: lua-5.3.4-bug4.patch
Patch11: lua-5.3.4-bug5.patch
BuildRequires: automake autoconf libtool readline-devel ncurses-devel
BuildRequires: make
Provides: lua(abi) = %{major_version}
Requires: lua-libs = %{version}-%{release}
%description
@ -64,10 +60,8 @@ configuration, scripting, and rapid prototyping.
%package devel
Summary: Development files for %{name}
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
# The RPM related dependencies bring nothing to a non-RPM Lua developer
# But we want them when packages BuildRequire lua-devel
Requires: (lua-rpm-macros if rpm-build)
Requires: pkgconfig
%description devel
@ -75,13 +69,13 @@ This package contains development files for %{name}.
%package libs
Summary: Libraries for %{name}
Provides: lua(abi) = %{major_version}
%description libs
This package contains the shared libraries for %{name}.
%package static
Summary: Static library for %{name}
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description static
@ -90,7 +84,7 @@ This package contains the static version of liblua for %{name}.
%prep
%if 0%{?bootstrap}
%setup -q -a 2 -a 3 -n %{name}-%{version}
%setup -q -a 2 -a 3
%else
%setup -q -a 3
%endif
@ -101,11 +95,9 @@ mv src/luaconf.h src/luaconf.h.template.in
#%% patch2 -p1 -z .luac-shared
%patch3 -p1 -z .configure-linux
%patch4 -p1 -z .configure-compat-all
%patch7 -p1 -b .5.4.4-bug1
%patch8 -p1 -b .5.4.4-bug2
%patch9 -p1 -b .5.4.4-bug3
%patch10 -p1 -b .5.4.4-bug4
%patch11 -p1 -b .5.4.4-bug5
%patch9 -p1 -b .bug1
%patch10 -p1 -b .bug4
%patch11 -p1 -b .bug5
# Put proper version in configure.ac, patch0 hardcodes 5.3.0
sed -i 's|5.3.0|%{version}|g' configure.ac
autoreconf -ifv
@ -114,10 +106,10 @@ autoreconf -ifv
cd lua-%{bootstrap_version}/
mv src/luaconf.h src/luaconf.h.template.in
%patch5 -p1 -b .autoxxx
%patch1 -p1 -b .idsize
%patch6 -p1 -b .idsize
%patch7 -p1 -b .luac-shared
%patch3 -p1 -z .configure-linux
%patch4 -p1 -z .configure-compat-all
%patch6 -p1 -b .luac-shared-link-fix
%patch8 -p1 -z .configure-compat-all
autoreconf -i
cd ..
%endif
@ -132,7 +124,7 @@ sed -i 's|@pkgdatadir@|%{_datadir}|g' src/luaconf.h.template
# hack so that only /usr/bin/lua gets linked with readline as it is the
# only one which needs this and otherwise we get License troubles
%make_build LIBS="-lm -ldl"
make %{?_smp_mflags} LIBS="-lm -ldl"
# only /usr/bin/lua links with readline now #luac_LDADD="liblua.la -lm -ldl"
%if 0%{?bootstrap}
@ -145,12 +137,12 @@ sed -i 's|@pkgdatadir@|%{_datadir}|g' src/luaconf.h.template
# hack so that only /usr/bin/lua gets linked with readline as it is the
# only one which needs this and otherwise we get License troubles
%make_build LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl"
make %{?_smp_mflags} LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl"
popd
%endif
%check
cd ./lua-%{test_version}-tests/
cd ./lua-%{version}-tests/
# Dont skip the fully portable or ram-hungry tests:
# sed -i.orig -e '
@ -169,7 +161,7 @@ sed -i.orig -e '
LD_LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir} $RPM_BUILD_ROOT/%{_bindir}/lua -e"_U=true" all.lua
%install
%make_install
make install DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT%{_libdir}/*.la
mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/%{major_version}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/%{major_version}
@ -190,6 +182,9 @@ rm -rf $RPM_BUILD_ROOT/installdir
popd
%endif
# Install rpm-macro
install -Dpm 0644 %{SOURCE1000} $RPM_BUILD_ROOT/%{macrosdir}/macros.lua
%files
%{!?_licensedir:%global license %%doc}
%license mit.txt
@ -197,19 +192,20 @@ popd
%doc README doc/*.html doc/*.css doc/*.gif doc/*.png
%{_bindir}/lua
%{_bindir}/luac
%if 0%{?bootstrap}
%dir %{_libdir}/lua/%{bootstrap_major_version}
%dir %{_datadir}/lua/%{bootstrap_major_version}
%endif
%{_mandir}/man1/lua*.1*
%files libs
%dir %{_libdir}/lua
%dir %{_libdir}/lua/%{major_version}
%{_libdir}/liblua-%{major_version}.so
%dir %{_datadir}/lua
%dir %{_datadir}/lua/%{major_version}
%files libs
%{_libdir}/liblua-%{major_version}.so
%if 0%{?bootstrap}
%dir %{_libdir}/lua/%{bootstrap_major_version}
%{_libdir}/liblua-%{bootstrap_major_version}.so
%dir %{_datadir}/lua/%{bootstrap_major_version}
%endif
%files devel
@ -217,105 +213,13 @@ popd
%{_includedir}/l*.hpp
%{_libdir}/liblua.so
%{_libdir}/pkgconfig/*.pc
%{macrosdir}/macros.lua
%files static
%{_libdir}/*.a
%changelog
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Jul 19 2022 Tom Callaway <spot@fedoraproject.org> - 5.4.4-3
- upstream bug fixes (3,4,5) including fix for CVE-2022-33099
* Tue Apr 5 2022 Tom Callaway <spot@fedoraproject.org> - 5.4.4-2
- upstream bug fixes
* Tue Feb 1 2022 Tom Callaway <spot@fedoraproject.org> - 5.4.4-1
- update to 5.4.4, update bootstrap code to 5.3.6
- 5.4.4 contains the fix for 5.4.3 bug7, which is also CVE-2021-43519
This fix was also in 5.4.3-4, so you do not need to update solely for that.
* Mon Jan 24 2022 Tom Callaway <spot@fedoraproject.org> - 5.4.3-4
- apply upstream fix for CVE-2021-44647
- apply upstream fixes for known lua bugs 4-10 (11 assumes other changes beyond 5.4.3)
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Mar 31 2021 Tom Callaway <spot@fedoraproject.org> - 5.4.3-1
- update to 5.4.3
- apply fix for bug3
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Dec 3 2020 Tom Callaway <spot@fedoraproject.org> - 5.4.2-1
- update to 5.4.2
* Mon Oct 12 2020 Tom Callaway <spot@fedoraproject.org> - 5.4.1-1
- update to 5.4.1
* Wed Sep 2 2020 Tom Callaway <spot@fedoraproject.org> - 5.4.0-8
- apply upstream fix for CVE-2020-24342
* Mon Aug 31 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.4.0-7
- Refactor macros into lua-rpm-macros
* Wed Aug 19 2020 Tom Callaway <spot@fedoraproject.org> - 5.4.0-6
- apply upstream fix for CVE-2020-24370, CVE-2020-24371
* Wed Aug 19 2020 Tom Callaway <spot@fedoraproject.org> - 5.4.0-5
- apply upstream fix for CVE-2020-24369
* Fri Jul 31 2020 Tom Callaway <spot@fedoraproject.org> - 5.4.0-4
- apply upstream fix for CVE-2020-15889
- apply upstream fix for CVE-2020-15945
- apply upstream fixes for "known bugs"
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jun 30 2020 Miro Hrončok <mhroncok@redhat.com> - 5.4.0-2
- Add lua(abi) requirements generator (requires RPM 4.16+)
* Mon Jun 29 2020 Tom Callaway <spot@fedoraproject.org> - 5.4.0-1
- update to 5.4.0
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 5.3.5-5
- Rebuild for readline 8.0
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jan 28 2019 Tom Callaway <spot@fedoraproject.org> - 5.3.5-3
- apply fix for CVE-2019-6706 (bz1670020)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jul 10 2018 Tom Callaway <spot@fedoraproject.org> - 5.3.5-1
- update to 5.3.5
* Tue Feb 13 2018 Tom Callaway <spot@fedoraproject.org> - 5.3.4-10
- move lua(abi) provide to -libs
- add fix for bug 6
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.4-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Tue Jan 2 2018 Richard W.M. Jones <rjones@redhat.com> - 5.3.4-8
- Unnecessary change to RISC-V macros in GCC requires change in luaconf.h.
* Mon Dec 4 2017 Tom Callaway <spot@fedoraproject.org> - 5.3.4-7
- fix pkgconfig provides (bz1519921)

View File

@ -52,7 +52,7 @@
#include "luaconf-mipsel.h"
#elif defined(__mips)
#include "luaconf-mips.h"
#elif defined(__riscv)
#elif defined(__riscv__)
#include "luaconf-riscv64.h"
#else
#error "The lua-devel package is not usable with the architecture."

13
macros.lua Normal file
View File

@ -0,0 +1,13 @@
%lua_version %{lua: print(string.sub(_VERSION, 5))}
%lua_libdir %{_libdir}/lua/%{lua_version}
%lua_pkgdir %{_datadir}/lua/%{lua_version}
%lua_requires \
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7 \
Requires: lua(abi) = %{lua_version} \
%else \
Requires: lua >= %{lua_version} \
Requires: lua < %{lua: os.setlocale('C'); print(string.sub(_VERSION, 5) + 0.1)} \
%endif \
%{nil}

View File

@ -1,3 +1,3 @@
SHA512 (lua-5.4.4.tar.gz) = af0c35d5ba00fecbb2dd617bd7b825edf7418a16a73076e04f2a0df58cdbf098dc3ff4402e974afd789eb5d86d2e12ec6df9c84b99b23656ea694a85f83bcd21
SHA512 (lua-5.4.4-tests.tar.gz) = 08b3d764b3f362a2cddf5a23e71b16eea96a234a970fa0048bab358ebbd77f99d9bd132af12254383c5bb5426516e1ce2107e529e88d3963869255f5a41198ef
SHA512 (lua-5.3.6.tar.gz) = ccc380d5e114d54504de0bfb0321ca25ec325d6ff1bfee44b11870b660762d1a9bf120490c027a0088128b58bb6b5271bbc648400cab84d2dc22b512c4841681
SHA512 (lua-5.2.3.tar.gz) = 264bb7c8db2f190ef0ca38584ec81999ab588f54e03119c5214c40bb8925b0eb407fac483a03e40cc8a220f6748ddff7d3a7392da3803418276b0d263b866449
SHA512 (lua-5.3.4.tar.gz) = 739e31f82e6a60fa99910c2005e991b3a1e21339af52847f653cb190b30842054d189ca116ffcfdf9b36e07888c9ce5642b1dd2988cc7eff9f8789f9a2e34997
SHA512 (lua-5.3.4-tests.tar.gz) = 79575d100a2efabc8243f55b55d912443e09ef7e8b0219cb93541d85c2ba802fb9538015e1228703f09ca57bdb28a640a8f1fa0735716ba1e4bca2179c712dfb