|
|
e89c7d |
# patch-lua-5.1.4-2 created 2010-05-14T21:02:40-0300
|
|
|
e89c7d |
# apply to a pristine copy of Lua 5.1.4 with:
|
|
|
e89c7d |
# wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
|
|
|
e89c7d |
# tar zxf lua-5.1.4.tar.gz
|
|
|
e89c7d |
# cd lua-5.1.4/src
|
|
|
e89c7d |
# wget http://www.lua.org/ftp/patch-lua-5.1.4-2
|
|
|
e89c7d |
# patch < patch-lua-5.1.4-2
|
|
|
e89c7d |
# use curl -O -R if you don't have wget
|
|
|
e89c7d |
|
|
|
e89c7d |
--- lcode.c 2007/12/28 15:32:23 2.25.1.3
|
|
|
e89c7d |
+++ lcode.c 2009/06/15 14:12:25 2.25.1.4
|
|
|
e89c7d |
@@ -1,5 +1,5 @@
|
|
|
e89c7d |
/*
|
|
|
e89c7d |
-** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $
|
|
|
e89c7d |
+** $Id: lcode.c,v 2.25.1.4 2009/06/15 14:12:25 roberto Exp $
|
|
|
e89c7d |
** Code generator for Lua
|
|
|
e89c7d |
** See Copyright Notice in lua.h
|
|
|
e89c7d |
*/
|
|
|
e89c7d |
@@ -544,15 +544,18 @@
|
|
|
e89c7d |
pc = NO_JUMP; /* always true; do nothing */
|
|
|
e89c7d |
break;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
- case VFALSE: {
|
|
|
e89c7d |
- pc = luaK_jump(fs); /* always jump */
|
|
|
e89c7d |
- break;
|
|
|
e89c7d |
- }
|
|
|
e89c7d |
case VJMP: {
|
|
|
e89c7d |
invertjump(fs, e);
|
|
|
e89c7d |
pc = e->u.s.info;
|
|
|
e89c7d |
break;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
+ case VFALSE: {
|
|
|
e89c7d |
+ if (!hasjumps(e)) {
|
|
|
e89c7d |
+ pc = luaK_jump(fs); /* always jump */
|
|
|
e89c7d |
+ break;
|
|
|
e89c7d |
+ }
|
|
|
e89c7d |
+ /* else go through */
|
|
|
e89c7d |
+ }
|
|
|
e89c7d |
default: {
|
|
|
e89c7d |
pc = jumponcond(fs, e, 0);
|
|
|
e89c7d |
break;
|
|
|
e89c7d |
@@ -572,14 +575,17 @@
|
|
|
e89c7d |
pc = NO_JUMP; /* always false; do nothing */
|
|
|
e89c7d |
break;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
- case VTRUE: {
|
|
|
e89c7d |
- pc = luaK_jump(fs); /* always jump */
|
|
|
e89c7d |
- break;
|
|
|
e89c7d |
- }
|
|
|
e89c7d |
case VJMP: {
|
|
|
e89c7d |
pc = e->u.s.info;
|
|
|
e89c7d |
break;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
+ case VTRUE: {
|
|
|
e89c7d |
+ if (!hasjumps(e)) {
|
|
|
e89c7d |
+ pc = luaK_jump(fs); /* always jump */
|
|
|
e89c7d |
+ break;
|
|
|
e89c7d |
+ }
|
|
|
e89c7d |
+ /* else go through */
|
|
|
e89c7d |
+ }
|
|
|
e89c7d |
default: {
|
|
|
e89c7d |
pc = jumponcond(fs, e, 1);
|
|
|
e89c7d |
break;
|
|
|
e89c7d |
--- ldblib.c 2008/01/21 13:11:21 1.104.1.3
|
|
|
e89c7d |
+++ ldblib.c 2009/08/04 18:50:18 1.104.1.4
|
|
|
e89c7d |
@@ -1,5 +1,5 @@
|
|
|
e89c7d |
/*
|
|
|
e89c7d |
-** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $
|
|
|
e89c7d |
+** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $
|
|
|
e89c7d |
** Interface from Lua to its debug API
|
|
|
e89c7d |
** See Copyright Notice in lua.h
|
|
|
e89c7d |
*/
|
|
|
e89c7d |
@@ -45,6 +45,7 @@
|
|
|
e89c7d |
|
|
|
e89c7d |
|
|
|
e89c7d |
static int db_getfenv (lua_State *L) {
|
|
|
e89c7d |
+ luaL_checkany(L, 1);
|
|
|
e89c7d |
lua_getfenv(L, 1);
|
|
|
e89c7d |
return 1;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
--- liolib.c 2008/01/18 17:47:43 2.73.1.3
|
|
|
e89c7d |
+++ liolib.c 2010/05/14 15:33:51 2.73.1.4
|
|
|
e89c7d |
@@ -1,5 +1,5 @@
|
|
|
e89c7d |
/*
|
|
|
e89c7d |
-** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $
|
|
|
e89c7d |
+** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $
|
|
|
e89c7d |
** Standard I/O (and system) library
|
|
|
e89c7d |
** See Copyright Notice in lua.h
|
|
|
e89c7d |
*/
|
|
|
e89c7d |
@@ -276,7 +276,10 @@
|
|
|
e89c7d |
lua_pushnumber(L, d);
|
|
|
e89c7d |
return 1;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
- else return 0; /* read fails */
|
|
|
e89c7d |
+ else {
|
|
|
e89c7d |
+ lua_pushnil(L); /* "result" to be removed */
|
|
|
e89c7d |
+ return 0; /* read fails */
|
|
|
e89c7d |
+ }
|
|
|
e89c7d |
}
|
|
|
e89c7d |
|
|
|
e89c7d |
|
|
|
e89c7d |
--- llex.c 2007/12/27 13:02:25 2.20.1.1
|
|
|
e89c7d |
+++ llex.c 2009/11/23 14:58:22 2.20.1.2
|
|
|
e89c7d |
@@ -1,5 +1,5 @@
|
|
|
e89c7d |
/*
|
|
|
e89c7d |
-** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $
|
|
|
e89c7d |
+** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $
|
|
|
e89c7d |
** Lexical Analyzer
|
|
|
e89c7d |
** See Copyright Notice in lua.h
|
|
|
e89c7d |
*/
|
|
|
e89c7d |
@@ -118,8 +118,10 @@
|
|
|
e89c7d |
lua_State *L = ls->L;
|
|
|
e89c7d |
TString *ts = luaS_newlstr(L, str, l);
|
|
|
e89c7d |
TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */
|
|
|
e89c7d |
- if (ttisnil(o))
|
|
|
e89c7d |
+ if (ttisnil(o)) {
|
|
|
e89c7d |
setbvalue(o, 1); /* make sure `str' will not be collected */
|
|
|
e89c7d |
+ luaC_checkGC(L);
|
|
|
e89c7d |
+ }
|
|
|
e89c7d |
return ts;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
|
|
|
e89c7d |
--- loadlib.c 2008/08/06 13:29:28 1.52.1.3
|
|
|
e89c7d |
+++ loadlib.c 2009/09/09 13:17:16 1.52.1.4
|
|
|
e89c7d |
@@ -1,5 +1,5 @@
|
|
|
e89c7d |
/*
|
|
|
e89c7d |
-** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $
|
|
|
e89c7d |
+** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $
|
|
|
e89c7d |
** Dynamic library loader for Lua
|
|
|
e89c7d |
** See Copyright Notice in lua.h
|
|
|
e89c7d |
**
|
|
|
e89c7d |
@@ -639,7 +639,7 @@
|
|
|
e89c7d |
lua_pushvalue(L, -1);
|
|
|
e89c7d |
lua_replace(L, LUA_ENVIRONINDEX);
|
|
|
e89c7d |
/* create `loaders' table */
|
|
|
e89c7d |
- lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1);
|
|
|
e89c7d |
+ lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
|
|
|
e89c7d |
/* fill it with pre-defined loaders */
|
|
|
e89c7d |
for (i=0; loaders[i] != NULL; i++) {
|
|
|
e89c7d |
lua_pushcfunction(L, loaders[i]);
|
|
|
e89c7d |
--- lstrlib.c 2008/07/11 17:27:21 1.132.1.4
|
|
|
e89c7d |
+++ lstrlib.c 2010/05/14 15:34:19 1.132.1.5
|
|
|
e89c7d |
@@ -1,5 +1,5 @@
|
|
|
e89c7d |
/*
|
|
|
e89c7d |
-** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $
|
|
|
e89c7d |
+** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $
|
|
|
e89c7d |
** Standard library for string operations and pattern-matching
|
|
|
e89c7d |
** See Copyright Notice in lua.h
|
|
|
e89c7d |
*/
|
|
|
e89c7d |
@@ -754,6 +754,7 @@
|
|
|
e89c7d |
|
|
|
e89c7d |
|
|
|
e89c7d |
static int str_format (lua_State *L) {
|
|
|
e89c7d |
+ int top = lua_gettop(L);
|
|
|
e89c7d |
int arg = 1;
|
|
|
e89c7d |
size_t sfl;
|
|
|
e89c7d |
const char *strfrmt = luaL_checklstring(L, arg, &sfl;;
|
|
|
e89c7d |
@@ -768,7 +769,8 @@
|
|
|
e89c7d |
else { /* format item */
|
|
|
e89c7d |
char form[MAX_FORMAT]; /* to store the format (`%...') */
|
|
|
e89c7d |
char buff[MAX_ITEM]; /* to store the formatted item */
|
|
|
e89c7d |
- arg++;
|
|
|
e89c7d |
+ if (++arg > top)
|
|
|
e89c7d |
+ luaL_argerror(L, arg, "no value");
|
|
|
e89c7d |
strfrmt = scanformat(L, strfrmt, form);
|
|
|
e89c7d |
switch (*strfrmt++) {
|
|
|
e89c7d |
case 'c': {
|
|
|
e89c7d |
--- lvm.c 2007/12/28 15:32:23 2.63.1.3
|
|
|
e89c7d |
+++ lvm.c 2009/07/01 21:10:33 2.63.1.4
|
|
|
e89c7d |
@@ -1,5 +1,5 @@
|
|
|
e89c7d |
/*
|
|
|
e89c7d |
-** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $
|
|
|
e89c7d |
+** $Id: lvm.c,v 2.63.1.4 2009/07/01 21:10:33 roberto Exp $
|
|
|
e89c7d |
** Lua virtual machine
|
|
|
e89c7d |
** See Copyright Notice in lua.h
|
|
|
e89c7d |
*/
|
|
|
e89c7d |
@@ -133,6 +133,7 @@
|
|
|
e89c7d |
|
|
|
e89c7d |
void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
|
|
e89c7d |
int loop;
|
|
|
e89c7d |
+ TValue temp;
|
|
|
e89c7d |
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
|
|
e89c7d |
const TValue *tm;
|
|
|
e89c7d |
if (ttistable(t)) { /* `t' is a table? */
|
|
|
e89c7d |
@@ -152,7 +153,9 @@
|
|
|
e89c7d |
callTM(L, tm, t, key, val);
|
|
|
e89c7d |
return;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
- t = tm; /* else repeat with `tm' */
|
|
|
e89c7d |
+ /* else repeat with `tm' */
|
|
|
e89c7d |
+ setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */
|
|
|
e89c7d |
+ t = &tem;;
|
|
|
e89c7d |
}
|
|
|
e89c7d |
luaG_runerror(L, "loop in settable");
|
|
|
e89c7d |
}
|