Hello community,

here is the log from the commit of package lua53 for openSUSE:Factory checked 
in at 2020-10-04 17:29:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lua53 (Old)
 and      /work/SRC/openSUSE:Factory/.lua53.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lua53"

Sun Oct  4 17:29:51 2020 rev:5 rq:837825 version:5.3.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/lua53/lua53.changes      2020-08-28 
23:44:26.071522694 +0200
+++ /work/SRC/openSUSE:Factory/.lua53.new.4249/lua53.changes    2020-10-04 
17:29:59.240227207 +0200
@@ -1,0 +2,9 @@
+Fri Sep 25 14:46:59 UTC 2020 - Callum Farmer <callumjfarme...@gmail.com>
+
+- Update to version 5.3.6:
+  * Fixes bugs found in Lua 5.3.5 and Lua 5.4.0
+  * Lua 5.3 is now EOL
+- Removed upstream-bugs.patch: new release (no bugs found yet)
+- Removed upstream-bugs-backport-lua54.patch: new release (no bugs found yet)
+
+-------------------------------------------------------------------

Old:
----
  lua-5.3.5.tar.gz
  upstream-bugs-backport-lua54.patch
  upstream-bugs.patch

New:
----
  lua-5.3.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lua53.spec ++++++
--- /var/tmp/diff_new_pack.PtjqMu/_old  2020-10-04 17:30:01.732229596 +0200
+++ /var/tmp/diff_new_pack.PtjqMu/_new  2020-10-04 17:30:01.732229596 +0200
@@ -19,7 +19,7 @@
 %define major_version 5.3
 %define libname liblua5_3-5
 Name:           lua53
-Version:        5.3.5
+Version:        5.3.6
 Release:        0
 Summary:        Small Embeddable Language with Procedural Syntax
 License:        MIT
@@ -29,10 +29,10 @@
 Source99:       baselibs.conf
 # PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE
 Patch0:         lua-build-system.patch
-# PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html#5.3.5
-Patch1:         upstream-bugs.patch
+# PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html#5.3.6
+#Patch1:        upstream-bugs.patch
 # PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html#5.4.0
-Patch2:         upstream-bugs-backport-lua54.patch
+#Patch2:        upstream-bugs-backport-lua54.patch
 BuildRequires:  libtool
 BuildRequires:  lua-macros
 BuildRequires:  pkgconfig

++++++ lua-5.3.5.tar.gz -> lua-5.3.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/Makefile new/lua-5.3.6/Makefile
--- old/lua-5.3.5/Makefile      2016-12-20 17:26:08.000000000 +0100
+++ new/lua-5.3.6/Makefile      2020-07-13 20:38:27.000000000 +0200
@@ -46,7 +46,7 @@
 
 # Lua version and release.
 V= 5.3
-R= $V.4
+R= $V.6
 
 # Targets start here.
 all:   $(PLAT)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/README new/lua-5.3.6/README
--- old/lua-5.3.5/README        2018-06-26 18:21:46.000000000 +0200
+++ new/lua-5.3.6/README        2020-09-14 17:35:46.000000000 +0200
@@ -1,5 +1,5 @@
 
-This is Lua 5.3.5, released on 26 Jun 2018.
+This is Lua 5.3.6, released on 14 Sep 2020.
 
 For installation instructions, license details, and
 further information about Lua, see doc/readme.html.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/doc/contents.html 
new/lua-5.3.6/doc/contents.html
--- old/lua-5.3.5/doc/contents.html     2018-06-19 03:56:08.000000000 +0200
+++ new/lua-5.3.6/doc/contents.html     2020-08-25 15:45:15.000000000 +0200
@@ -32,7 +32,7 @@
 
 <P>
 <SMALL>
-Copyright &copy; 2015&ndash;2018 Lua.org, PUC-Rio.
+Copyright &copy; 2015&ndash;2020 Lua.org, PUC-Rio.
 Freely available under the terms of the
 <A HREF="http://www.lua.org/license.html";>Lua license</A>.
 </SMALL>
@@ -318,6 +318,37 @@
 <A HREF="manual.html#pdf-utf8.len">utf8.len</A><BR>
 <A HREF="manual.html#pdf-utf8.offset">utf8.offset</A><BR>
 
+<H3><A NAME="metamethods">metamethods</A></H3>
+<P>
+<A HREF="manual.html#2.4">__add</A><BR>
+<A HREF="manual.html#2.4">__band</A><BR>
+<A HREF="manual.html#2.4">__bnot</A><BR>
+<A HREF="manual.html#2.4">__bor</A><BR>
+<A HREF="manual.html#2.4">__bxor</A><BR>
+<A HREF="manual.html#2.4">__call</A><BR>
+<A HREF="manual.html#2.4">__concat</A><BR>
+<A HREF="manual.html#2.4">__div</A><BR>
+<A HREF="manual.html#2.4">__eq</A><BR>
+<A HREF="manual.html#2.5.1">__gc</A><BR>
+<A HREF="manual.html#2.4">__idiv</A><BR>
+<A HREF="manual.html#2.4">__index</A><BR>
+<A HREF="manual.html#2.4">__le</A><BR>
+<A HREF="manual.html#2.4">__len</A><BR>
+<A HREF="manual.html#2.4">__lt</A><BR>
+<A HREF="manual.html#pdf-getmetatable">__metatable</A><BR>
+<A HREF="manual.html#2.4">__mod</A><BR>
+<A HREF="manual.html#2.5.2">__mode</A><BR>
+<A HREF="manual.html#2.4">__mul</A><BR>
+<A HREF="manual.html#luaL_newmetatable">__name</A><BR>
+<A HREF="manual.html#2.4">__newindex</A><BR>
+<A HREF="manual.html#pdf-pairs">__pairs</A><BR>
+<A HREF="manual.html#2.4">__pow</A><BR>
+<A HREF="manual.html#2.4">__shl</A><BR>
+<A HREF="manual.html#2.4">__shr</A><BR>
+<A HREF="manual.html#2.4">__sub</A><BR>
+<A HREF="manual.html#pdf-tostring">__tostring</A><BR>
+<A HREF="manual.html#2.4">__unm</A><BR>
+
 <H3><A NAME="env">environment<BR>variables</A></H3>
 <P>
 <A HREF="manual.html#pdf-LUA_CPATH">LUA_CPATH</A><BR>
@@ -609,10 +640,10 @@
 
 <P CLASS="footer">
 Last update:
-Mon Jun 18 22:56:06 -03 2018
+Tue Aug 25 13:45:14 UTC 2020
 </P>
 <!--
-Last change: revised for Lua 5.3.5
+Last change: revised for Lua 5.3.6
 -->
 
 </BODY>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/doc/manual.html 
new/lua-5.3.6/doc/manual.html
--- old/lua-5.3.5/doc/manual.html       2018-06-26 18:16:37.000000000 +0200
+++ new/lua-5.3.6/doc/manual.html       2020-07-14 12:32:40.000000000 +0200
@@ -19,7 +19,7 @@
 
 <P>
 <SMALL>
-Copyright &copy; 2015&ndash;2018 Lua.org, PUC-Rio.
+Copyright &copy; 2015&ndash;2020 Lua.org, PUC-Rio.
 Freely available under the terms of the
 <a href="http://www.lua.org/license.html";>Lua license</a>.
 </SMALL>
@@ -10972,10 +10972,10 @@
 
 <P CLASS="footer">
 Last update:
-Tue Jun 26 13:16:37 -03 2018
+Tue Jul 14 10:32:39 UTC 2020
 </P>
 <!--
-Last change: revised for Lua 5.3.5
+Last change: revised for Lua 5.3.6
 -->
 
 </body></html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/doc/readme.html 
new/lua-5.3.6/doc/readme.html
--- old/lua-5.3.5/doc/readme.html       2018-06-19 03:57:34.000000000 +0200
+++ new/lua-5.3.6/doc/readme.html       2020-07-14 12:33:02.000000000 +0200
@@ -107,7 +107,7 @@
 <OL>
 <LI>
 Open a terminal window and move to
-the top-level directory, which is named <TT>lua-5.3.5</TT>.
+the top-level directory, which is named <TT>lua-5.3.6</TT>.
 The <TT>Makefile</TT> there controls both the build process and the 
installation process.
 <P>
 <LI>
@@ -328,7 +328,7 @@
 <A HREF="http://www.lua.org/license.html";>this</A>.
 
 <BLOCKQUOTE STYLE="padding-bottom: 0em">
-Copyright &copy; 1994&ndash;2017 Lua.org, PUC-Rio.
+Copyright &copy; 1994&ndash;2020 Lua.org, PUC-Rio.
 
 <P>
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -355,10 +355,10 @@
 
 <P CLASS="footer">
 Last update:
-Mon Jun 18 22:57:33 -03 2018
+Tue Jul 14 10:33:01 UTC 2020
 </P>
 <!--
-Last change: revised for Lua 5.3.5
+Last change: revised for Lua 5.3.6
 -->
 
 </BODY>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/Makefile new/lua-5.3.6/src/Makefile
--- old/lua-5.3.5/src/Makefile  2018-06-25 19:46:36.000000000 +0200
+++ new/lua-5.3.6/src/Makefile  2020-07-13 20:38:14.000000000 +0200
@@ -102,7 +102,7 @@
 
 
 freebsd:
-       $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE 
-I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
+       $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -I/usr/include/edit" 
SYSLIBS="-Wl,-E -ledit" CC="cc"
 
 generic: $(ALL)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/lapi.c new/lua-5.3.6/src/lapi.c
--- old/lua-5.3.5/src/lapi.c    2017-12-06 19:35:12.000000000 +0100
+++ new/lua-5.3.6/src/lapi.c    2020-09-14 17:34:00.000000000 +0200
@@ -1254,13 +1254,12 @@
 }
 
 
-static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
+static UpVal **getupvalref (lua_State *L, int fidx, int n) {
   LClosure *f;
   StkId fi = index2addr(L, fidx);
   api_check(L, ttisLclosure(fi), "Lua function expected");
   f = clLvalue(fi);
   api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index");
-  if (pf) *pf = f;
   return &f->upvals[n - 1];  /* get its upvalue pointer */
 }
 
@@ -1269,7 +1268,7 @@
   StkId fi = index2addr(L, fidx);
   switch (ttype(fi)) {
     case LUA_TLCL: {  /* lua closure */
-      return *getupvalref(L, fidx, n, NULL);
+      return *getupvalref(L, fidx, n);
     }
     case LUA_TCCL: {  /* C closure */
       CClosure *f = clCvalue(fi);
@@ -1286,9 +1285,10 @@
 
 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 **up2 = getupvalref(L, fidx2, n2, NULL);
+  UpVal **up1 = getupvalref(L, fidx1, n1);
+  UpVal **up2 = getupvalref(L, fidx2, n2);
+  if (*up1 == *up2)
+    return;
   luaC_upvdeccount(L, *up1);
   *up1 = *up2;
   (*up1)->refcount++;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/lauxlib.c new/lua-5.3.6/src/lauxlib.c
--- old/lua-5.3.5/src/lauxlib.c 2017-04-19 19:20:42.000000000 +0200
+++ new/lua-5.3.6/src/lauxlib.c 2020-09-14 17:34:00.000000000 +0200
@@ -1011,8 +1011,13 @@
     free(ptr);
     return NULL;
   }
-  else
-    return realloc(ptr, nsize);
+  else {  /* cannot fail when shrinking a block */
+    void *newptr = realloc(ptr, nsize);
+    if (newptr == NULL && ptr != NULL && nsize <= osize)
+      return ptr;  /* keep the original block */
+    else  /* no fail or not shrinking */
+     return newptr;  /* use the new block */
+  }
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/lcode.c new/lua-5.3.6/src/lcode.c
--- old/lua-5.3.5/src/lcode.c   2017-04-19 19:20:42.000000000 +0200
+++ new/lua-5.3.6/src/lcode.c   2020-09-14 17:34:00.000000000 +0200
@@ -1061,7 +1061,7 @@
 
 
 /*
-** Aplly prefix operation 'op' to expression 'e'.
+** Apply prefix operation 'op' to expression 'e'.
 */
 void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {
   static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/ldebug.c new/lua-5.3.6/src/ldebug.c
--- old/lua-5.3.5/src/ldebug.c  2017-07-10 19:21:50.000000000 +0200
+++ new/lua-5.3.6/src/ldebug.c  2020-09-14 17:34:00.000000000 +0200
@@ -133,10 +133,11 @@
 
 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 @@
   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));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/liolib.c new/lua-5.3.6/src/liolib.c
--- old/lua-5.3.5/src/liolib.c  2017-04-19 19:29:57.000000000 +0200
+++ new/lua-5.3.6/src/liolib.c  2020-09-14 17:34:00.000000000 +0200
@@ -277,6 +277,8 @@
   const char *filename = luaL_checkstring(L, 1);
   const char *mode = luaL_optstring(L, 2, "r");
   LStream *p = newprefile(L);
+  luaL_argcheck(L, ((mode[0] == 'r' || mode[0] == 'w') && mode[1] == '\0'),
+                   2, "invalid mode");
   p->f = l_popen(L, filename, mode);
   p->closef = &io_pclose;
   return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/llex.c new/lua-5.3.6/src/llex.c
--- old/lua-5.3.5/src/llex.c    2017-04-19 19:20:42.000000000 +0200
+++ new/lua-5.3.6/src/llex.c    2020-09-14 17:34:00.000000000 +0200
@@ -244,12 +244,12 @@
 
 
 /*
-** skip a sequence '[=*[' or ']=*]'; if sequence is well formed, return
-** its number of '='s; otherwise, return a negative number (-1 iff there
-** are no '='s after initial bracket)
+** reads a sequence '[=*[' or ']=*]', leaving the last bracket.
+** If sequence is well formed, return its number of '='s + 2; otherwise,
+** return 1 if there is no '='s or 0 otherwise (an unfinished '[==...').
 */
-static int skip_sep (LexState *ls) {
-  int count = 0;
+static size_t skip_sep (LexState *ls) {
+  size_t count = 0;
   int s = ls->current;
   lua_assert(s == '[' || s == ']');
   save_and_next(ls);
@@ -257,11 +257,14 @@
     save_and_next(ls);
     count++;
   }
-  return (ls->current == s) ? count : (-count) - 1;
+  return (ls->current == s) ? count + 2
+         : (count == 0) ? 1
+         : 0;
+
 }
 
 
-static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
+static void read_long_string (LexState *ls, SemInfo *seminfo, size_t sep) {
   int line = ls->linenumber;  /* initial line (for error message) */
   save_and_next(ls);  /* skip 2nd '[' */
   if (currIsNewline(ls))  /* string starts with a newline? */
@@ -295,8 +298,8 @@
     }
   } endloop:
   if (seminfo)
-    seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep),
-                                     luaZ_bufflen(ls->buff) - 2*(2 + sep));
+    seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + sep,
+                                     luaZ_bufflen(ls->buff) - 2 * sep);
 }
 
 
@@ -444,9 +447,9 @@
         /* else is a comment */
         next(ls);
         if (ls->current == '[') {  /* long comment? */
-          int sep = skip_sep(ls);
+          size_t sep = skip_sep(ls);
           luaZ_resetbuffer(ls->buff);  /* 'skip_sep' may dirty the buffer */
-          if (sep >= 0) {
+          if (sep >= 2) {
             read_long_string(ls, NULL, sep);  /* skip long comment */
             luaZ_resetbuffer(ls->buff);  /* previous call may dirty the buff. 
*/
             break;
@@ -458,12 +461,12 @@
         break;
       }
       case '[': {  /* long string or simply '[' */
-        int sep = skip_sep(ls);
-        if (sep >= 0) {
+        size_t sep = skip_sep(ls);
+        if (sep >= 2) {
           read_long_string(ls, seminfo, sep);
           return TK_STRING;
         }
-        else if (sep != -1)  /* '[=...' missing second bracket */
+        else if (sep == 0)  /* '[=...' missing second bracket */
           lexerror(ls, "invalid long string delimiter", TK_STRING);
         return '[';
       }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/lobject.c new/lua-5.3.6/src/lobject.c
--- old/lua-5.3.5/src/lobject.c 2017-04-19 19:29:57.000000000 +0200
+++ new/lua-5.3.6/src/lobject.c 2020-09-14 17:34:01.000000000 +0200
@@ -266,7 +266,7 @@
 ** - 'n'/'N' means 'inf' or 'nan' (which should be rejected)
 ** - '.' just optimizes the search for the common case (nothing special)
 ** This function accepts both the current locale or a dot as the radix
-** mark. If the convertion fails, it may mean number has a dot but
+** mark. If the conversion fails, it may mean number has a dot but
 ** locale accepts something else. In that case, the code copies 's'
 ** to a buffer (because 's' is read-only), changes the dot to the
 ** current locale radix mark, and tries to convert again.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/lparser.c new/lua-5.3.6/src/lparser.c
--- old/lua-5.3.5/src/lparser.c 2017-04-29 20:11:40.000000000 +0200
+++ new/lua-5.3.6/src/lparser.c 2020-09-14 17:34:01.000000000 +0200
@@ -544,6 +544,7 @@
   fs->bl = NULL;
   f = fs->f;
   f->source = ls->source;
+  luaC_objbarrier(ls->L, f, f->source);
   f->maxstacksize = 2;  /* registers 0/1 are always valid */
   enterblock(fs, bl, 0);
 }
@@ -1616,6 +1617,7 @@
   fs->f->is_vararg = 1;  /* main function is always declared vararg */
   init_exp(&v, VLOCAL, 0);  /* create and... */
   newupvalue(fs, ls->envn, &v);  /* ...set environment upvalue */
+  luaC_objbarrier(ls->L, fs->f, ls->envn);
   luaX_next(ls);  /* read first token */
   statlist(ls);  /* parse main body */
   check(ls, TK_EOS);
@@ -1634,6 +1636,7 @@
   sethvalue(L, L->top, lexstate.h);  /* anchor it */
   luaD_inctop(L);
   funcstate.f = cl->p = luaF_newproto(L);
+  luaC_objbarrier(L, cl, cl->p);
   funcstate.f->source = luaS_new(L, name);  /* create and anchor TString */
   lua_assert(iswhite(funcstate.f));  /* do not need barrier here */
   lexstate.buff = buff;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/lua.h new/lua-5.3.6/src/lua.h
--- old/lua-5.3.5/src/lua.h     2018-06-13 18:58:17.000000000 +0200
+++ new/lua-5.3.6/src/lua.h     2020-09-14 17:34:01.000000000 +0200
@@ -1,5 +1,4 @@
 /*
-** $Id: lua.h,v 1.332.1.2 2018/06/13 16:58:17 roberto Exp $
 ** Lua - A Scripting Language
 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
 ** See Copyright Notice at the end of this file
@@ -19,11 +18,11 @@
 #define LUA_VERSION_MAJOR      "5"
 #define LUA_VERSION_MINOR      "3"
 #define LUA_VERSION_NUM                503
-#define LUA_VERSION_RELEASE    "5"
+#define LUA_VERSION_RELEASE    "6"
 
 #define LUA_VERSION    "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
 #define LUA_RELEASE    LUA_VERSION "." LUA_VERSION_RELEASE
-#define LUA_COPYRIGHT  LUA_RELEASE "  Copyright (C) 1994-2018 Lua.org, PUC-Rio"
+#define LUA_COPYRIGHT  LUA_RELEASE "  Copyright (C) 1994-2020 Lua.org, PUC-Rio"
 #define LUA_AUTHORS    "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
 
 
@@ -460,7 +459,7 @@
 
 
 /******************************************************************************
-* Copyright (C) 1994-2018 Lua.org, PUC-Rio.
+* Copyright (C) 1994-2020 Lua.org, PUC-Rio.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.3.5/src/lundump.c new/lua-5.3.6/src/lundump.c
--- old/lua-5.3.5/src/lundump.c 2017-04-19 19:20:42.000000000 +0200
+++ new/lua-5.3.6/src/lundump.c 2020-09-14 17:34:01.000000000 +0200
@@ -85,8 +85,10 @@
 }
 
 
-static TString *LoadString (LoadState *S) {
+static TString *LoadString (LoadState *S, Proto *p) {
+  lua_State *L = S->L;
   size_t size = LoadByte(S);
+  TString *ts;
   if (size == 0xFF)
     LoadVar(S, size);
   if (size == 0)
@@ -94,13 +96,17 @@
   else if (--size <= LUAI_MAXSHORTLEN) {  /* short string? */
     char buff[LUAI_MAXSHORTLEN];
     LoadVector(S, buff, size);
-    return luaS_newlstr(S->L, buff, size);
+    ts = luaS_newlstr(L, buff, size);
   }
   else {  /* long string */
-    TString *ts = luaS_createlngstrobj(S->L, size);
+    ts = luaS_createlngstrobj(L, size);
+    setsvalue2s(L, L->top, ts);  /* anchor it ('loadVector' can GC) */
+    luaD_inctop(L);
     LoadVector(S, getstr(ts), size);  /* load directly in final place */
-    return ts;
+    L->top--;  /* pop string */
   }
+  luaC_objbarrier(L, p, ts);
+  return ts;
 }
 
 
@@ -140,7 +146,7 @@
       break;
     case LUA_TSHRSTR:
     case LUA_TLNGSTR:
-      setsvalue2n(S->L, o, LoadString(S));
+      setsvalue2n(S->L, o, LoadString(S, f));
       break;
     default:
       lua_assert(0);
@@ -158,6 +164,7 @@
     f->p[i] = NULL;
   for (i = 0; i < n; i++) {
     f->p[i] = luaF_newproto(S->L);
+    luaC_objbarrier(S->L, f, f->p[i]);
     LoadFunction(S, f->p[i], f->source);
   }
 }
@@ -189,18 +196,18 @@
   for (i = 0; i < n; i++)
     f->locvars[i].varname = NULL;
   for (i = 0; i < n; i++) {
-    f->locvars[i].varname = LoadString(S);
+    f->locvars[i].varname = LoadString(S, f);
     f->locvars[i].startpc = LoadInt(S);
     f->locvars[i].endpc = LoadInt(S);
   }
   n = LoadInt(S);
   for (i = 0; i < n; i++)
-    f->upvalues[i].name = LoadString(S);
+    f->upvalues[i].name = LoadString(S, f);
 }
 
 
 static void LoadFunction (LoadState *S, Proto *f, TString *psource) {
-  f->source = LoadString(S);
+  f->source = LoadString(S, f);
   if (f->source == NULL)  /* no source in dump? */
     f->source = psource;  /* reuse parent's source */
   f->linedefined = LoadInt(S);
@@ -271,6 +278,7 @@
   setclLvalue(L, L->top, cl);
   luaD_inctop(L);
   cl->p = luaF_newproto(L);
+  luaC_objbarrier(L, cl, cl->p);
   LoadFunction(&S, cl->p, NULL);
   lua_assert(cl->nupvalues == cl->p->sizeupvalues);
   luai_verifycode(L, buff, cl->p);


Reply via email to