Fix multiple runtime errors and crashes in lua 5.3.4

Details
- Import upstream patches for known runtime errors
  and crashes in lua 5.3.4
  Details, see https://www.lua.org/bugs.html
  in the section on version 5.3.4

PR:		222581
Submitted by:	russ.haley@gmail.com
Approved by:	maintainer timeout
MFH:		2017Q4
This commit is contained in:
Thomas Zander 2017-11-11 12:48:53 +00:00
parent 880775a30d
commit 0779926ea3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=453971
4 changed files with 35 additions and 0 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= lua
PORTVERSION= 5.3.4
PORTREVISION= 1
CATEGORIES= lang
MASTER_SITES= http://www.lua.org/ftp/
PKGNAMESUFFIX= 53

View file

@ -0,0 +1,10 @@
--- src/ldebug.c.orig 2016-10-19 12:32:10 UTC
+++ src/ldebug.c
@@ -653,6 +653,7 @@ l_noret luaG_runerror (lua_State *L, const char *fmt,
CallInfo *ci = L->ci;
const char *msg;
va_list argp;
+ luaC_checkGC(L); /* error message uses memory */
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
va_end(argp);

View file

@ -0,0 +1,13 @@
--- src/lgc.c.orig 2016-12-22 13:08:50 UTC
+++ src/lgc.c
@@ -643,8 +643,9 @@ static void clearkeys (global_State *g, GCObject *l, G
for (n = gnode(h, 0); n < limit; n++) {
if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) {
setnilvalue(gval(n)); /* remove value ... */
- removeentry(n); /* and remove entry from table */
}
+ if (ttisnil(gval(n))) /* is entry empty? */
+ removeentry(n); /* remove entry from table */
}
}
}

View file

@ -0,0 +1,11 @@
--- src/lparser.c.orig 2016-08-01 19:51:24 UTC
+++ src/lparser.c
@@ -1392,7 +1392,7 @@ static void test_then_block (LexState *ls, int *escape
luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */
enterblock(fs, &bl, 0); /* must enter block before 'goto' */
gotostat(ls, v.t); /* handle goto/break */
- skipnoopstat(ls); /* skip other no-op statements */
+ while (testnext(ls, ';')) {} /* skip semicolons */
if (block_follow(ls, 0)) { /* 'goto' is the entire block? */
leaveblock(fs);
return; /* and that is it */