Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/mit/lua/dist Resolve conflicts.



details:   https://anonhg.NetBSD.org/src/rev/a408964cbf46
branches:  trunk
changeset: 340878:a408964cbf46
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Thu Oct 08 12:40:05 2015 +0000

description:
Resolve conflicts.

diffstat:

 external/mit/lua/dist/Makefile     |   2 +-
 external/mit/lua/dist/README       |   2 +-
 external/mit/lua/dist/src/ldblib.c |  23 +++++++++++++++++++++--
 3 files changed, 23 insertions(+), 4 deletions(-)

diffs (102 lines):

diff -r 8d177bf5f041 -r a408964cbf46 external/mit/lua/dist/Makefile
--- a/external/mit/lua/dist/Makefile    Thu Oct 08 12:25:22 2015 +0000
+++ b/external/mit/lua/dist/Makefile    Thu Oct 08 12:40:05 2015 +0000
@@ -46,7 +46,7 @@
 
 # Lua version and release.
 V= 5.3
-R= $V.0
+R= $V.1
 
 # Targets start here.
 all:   $(PLAT)
diff -r 8d177bf5f041 -r a408964cbf46 external/mit/lua/dist/README
--- a/external/mit/lua/dist/README      Thu Oct 08 12:25:22 2015 +0000
+++ b/external/mit/lua/dist/README      Thu Oct 08 12:40:05 2015 +0000
@@ -1,5 +1,5 @@
 
-This is Lua 5.3.0, released on 06 Jan 2015.
+This is Lua 5.3.1, released on 10 Jun 2015.
 
 For installation instructions, license details, and
 further information about Lua, see doc/readme.html.
diff -r 8d177bf5f041 -r a408964cbf46 external/mit/lua/dist/src/ldblib.c
--- a/external/mit/lua/dist/src/ldblib.c        Thu Oct 08 12:25:22 2015 +0000
+++ b/external/mit/lua/dist/src/ldblib.c        Thu Oct 08 12:40:05 2015 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: ldblib.c,v 1.5 2015/02/02 14:03:05 lneto Exp $ */
+/*     $NetBSD: ldblib.c,v 1.6 2015/10/08 12:40:05 mbalmer Exp $       */
 
 /*
-** Id: ldblib.c,v 1.148 2015/01/02 12:52:22 roberto Exp 
+** Id: ldblib.c,v 1.149 2015/02/19 17:06:21 roberto Exp 
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
@@ -31,6 +31,17 @@
 static const int HOOKKEY = 0;
 
 
+/*
+** If L1 != L, L1 can be in any state, and therefore there is no
+** garanties about its stack space; any push in L1 must be
+** checked.
+*/
+static void checkstack (lua_State *L, lua_State *L1, int n) {
+  if (L != L1 && !lua_checkstack(L1, n))
+    luaL_error(L, "stack overflow");
+}
+
+
 static int db_getregistry (lua_State *L) {
   lua_pushvalue(L, LUA_REGISTRYINDEX);
   return 1;
@@ -131,12 +142,16 @@
 
 /*
 ** Calls 'lua_getinfo' and collects all results in a new table.
+** L1 needs stack space for an optional input (function) plus
+** two optional outputs (function and line table) from function
+** 'lua_getinfo'.
 */
 static int db_getinfo (lua_State *L) {
   lua_Debug ar;
   int arg;
   lua_State *L1 = getthread(L, &arg);
   const char *options = luaL_optstring(L, arg+2, "flnStu");
+  checkstack(L, L1, 3);
   if (lua_isfunction(L, arg + 1)) {  /* info about a function? */
     options = lua_pushfstring(L, ">%s", options);  /* add '>' to 'options' */
     lua_pushvalue(L, arg + 1);  /* move function to 'L1' stack */
@@ -194,6 +209,7 @@
     int level = (int)luaL_checkinteger(L, arg + 1);
     if (!lua_getstack(L1, level, &ar))  /* out of range? */
       return luaL_argerror(L, arg+1, "level out of range");
+    checkstack(L, L1, 1);
     name = lua_getlocal(L1, &ar, nvar);
     if (name) {
       lua_xmove(L1, L, 1);  /* move local value */
@@ -220,6 +236,7 @@
     return luaL_argerror(L, arg+1, "level out of range");
   luaL_checkany(L, arg+3);
   lua_settop(L, arg+3);
+  checkstack(L, L1, 1);
   lua_xmove(L, L1, 1);
   name = lua_setlocal(L1, &ar, nvar);
   if (name == NULL)
@@ -354,6 +371,7 @@
     lua_pushvalue(L, -1);
     lua_setmetatable(L, -2);  /* setmetatable(hooktable) = hooktable */
   }
+  checkstack(L, L1, 1);
   lua_pushthread(L1); lua_xmove(L1, L, 1);  /* key (thread) */
   lua_pushvalue(L, arg + 1);  /* value (hook function) */
   lua_rawset(L, -3);  /* hooktable[L1] = new Lua hook */
@@ -374,6 +392,7 @@
     lua_pushliteral(L, "external hook");
   else {  /* hook table must exist */
     lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY);
+    checkstack(L, L1, 1);
     lua_pushthread(L1); lua_xmove(L1, L, 1);
     lua_rawget(L, -2);   /* 1st result = hooktable[L1] */
     lua_remove(L, -2);  /* remove hook table */



Home | Main Index | Thread Index | Old Index