FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Applied lua patch 5.1.4-3 · git99969/lua@1c87c33 · GitHub

Repository navigation

Commit 1c87c33

Browse files
committed
Applied lua patch 5.1.4-3
1 parent eb69716 commit 1c87c33

8 files changed

Lines changed: 24 additions & 21 deletions

File tree

‎src/lcode.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $
2+
** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $
33
** Code generator for Lua
44
** See Copyright Notice in lua.h
55
*/
@@ -544,10 +544,6 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
544544
pc = NO_JUMP; /* always true; do nothing */
545545
break;
546546
}
547-
case VFALSE: {
548-
pc = luaK_jump(fs); /* always jump */
549-
break;
550-
}
551547
case VJMP: {
552548
invertjump(fs, e);
553549
pc = e->u.s.info;
@@ -572,10 +568,6 @@ static void luaK_goiffalse (FuncState *fs, expdesc *e) {
572568
pc = NO_JUMP; /* always false; do nothing */
573569
break;
574570
}
575-
case VTRUE: {
576-
pc = luaK_jump(fs); /* always jump */
577-
break;
578-
}
579571
case VJMP: {
580572
pc = e->u.s.info;
581573
break;

‎src/ldblib.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $
2+
** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $
33
** Interface from Lua to its debug API
44
** See Copyright Notice in lua.h
55
*/
@@ -45,6 +45,7 @@ static int db_setmetatable (lua_State *L) {
4545

4646

4747
static int db_getfenv (lua_State *L) {
48+
luaL_checkany(L, 1);
4849
lua_getfenv(L, 1);
4950
return 1;
5051
}

‎src/liolib.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $
2+
** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $
33
** Standard I/O (and system) library
44
** See Copyright Notice in lua.h
55
*/
@@ -276,7 +276,10 @@ static int read_number (lua_State *L, FILE *f) {
276276
lua_pushnumber(L, d);
277277
return 1;
278278
}
279-
else return 0; /* read fails */
279+
else {
280+
lua_pushnil(L); /* "result" to be removed */
281+
return 0; /* read fails */
282+
}
280283
}
281284

282285

‎src/llex.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $
2+
** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $
33
** Lexical Analyzer
44
** See Copyright Notice in lua.h
55
*/
@@ -118,8 +118,10 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
118118
lua_State *L = ls->L;
119119
TString *ts = luaS_newlstr(L, str, l);
120120
TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */
121-
if (ttisnil(o))
121+
if (ttisnil(o)) {
122122
setbvalue(o, 1); /* make sure `str' will not be collected */
123+
luaC_checkGC(L);
124+
}
123125
return ts;
124126
}
125127

‎src/loadlib.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $
2+
** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $
33
** Dynamic library loader for Lua
44
** See Copyright Notice in lua.h
55
**
@@ -639,7 +639,7 @@ LUALIB_API int luaopen_package (lua_State *L) {
639639
lua_pushvalue(L, -1);
640640
lua_replace(L, LUA_ENVIRONINDEX);
641641
/* create `loaders' table */
642-
lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1);
642+
lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
643643
/* fill it with pre-defined loaders */
644644
for (i=0; loaders[i] != NULL; i++) {
645645
lua_pushcfunction(L, loaders[i]);

‎src/loadlib_rel.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ LUALIB_API int luaopen_package (lua_State *L) {
679679
lua_pushvalue(L, -1);
680680
lua_replace(L, LUA_ENVIRONINDEX);
681681
/* create `loaders' table */
682-
lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1);
682+
lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
683683
/* fill it with pre-defined loaders */
684684
for (i=0; loaders[i] != NULL; i++) {
685685
lua_pushcfunction(L, loaders[i]);

‎src/lstrlib.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $
2+
** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $
33
** Standard library for string operations and pattern-matching
44
** See Copyright Notice in lua.h
55
*/
@@ -754,6 +754,7 @@ static void addintlen (char *form) {
754754

755755

756756
static int str_format (lua_State *L) {
757+
int top = lua_gettop(L);
757758
int arg = 1;
758759
size_t sfl;
759760
const char *strfrmt = luaL_checklstring(L, arg, &sfl);
@@ -768,7 +769,8 @@ static int str_format (lua_State *L) {
768769
else { /* format item */
769770
char form[MAX_FORMAT]; /* to store the format (`%...') */
770771
char buff[MAX_ITEM]; /* to store the formatted item */
771-
arg++;
772+
if (++arg > top)
773+
luaL_argerror(L, arg, "no value");
772774
strfrmt = scanformat(L, strfrmt, form);
773775
switch (*strfrmt++) {
774776
case 'c': {

‎src/lvm.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $
2+
** $Id: lvm.c,v 2.63.1.4 2009/07/01 21:10:33 roberto Exp $
33
** Lua virtual machine
44
** See Copyright Notice in lua.h
55
*/
@@ -133,6 +133,7 @@ void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
133133

134134
void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
135135
int loop;
136+
TValue temp;
136137
for (loop = 0; loop < MAXTAGLOOP; loop++) {
137138
const TValue *tm;
138139
if (ttistable(t)) { /* `t' is a table? */
@@ -152,7 +153,9 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
152153
callTM(L, tm, t, key, val);
153154
return;
154155
}
155-
t = tm; /* else repeat with `tm' */
156+
/* else repeat with `tm' */
157+
setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */
158+
t = &temp;
156159
}
157160
luaG_runerror(L, "loop in settable");
158161
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL