From f6a81dbe9770f0e64d04b4e7be17c826d53253aa Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 31 Jul 2007 16:39:52 -0300 Subject: BUG: too many variables in an assignment may cause a C stack overflow --- lparser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lparser.c') diff --git a/lparser.c b/lparser.c index 8468ab0e..648a7437 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.52 2007/03/27 14:11:38 roberto Exp roberto $ +** $Id: lparser.c,v 2.53 2007/05/11 17:28:56 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -73,8 +73,8 @@ static void errorlimit (FuncState *fs, int limit, const char *what) { const char *where = (fs->f->linedefined == 0) ? "main function" : luaO_pushfstring(fs->L, "function at line %d", fs->f->linedefined); - msg = luaO_pushfstring(fs->L, "too many %s in %s (limit is %d)", - what, where, limit); + msg = luaO_pushfstring(fs->L, "too many %s (limit is %d) in %s", + what, limit, where); luaX_lexerror(fs->ls, msg, fs->ls->t.token); } @@ -946,6 +946,8 @@ static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { primaryexp(ls, &nv.v); if (nv.v.k == VLOCAL) check_conflict(ls, lh, &nv.v); + luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - G(ls->L)->nCcalls, + "variable names"); assignment(ls, &nv, nvars+1); } else { /* assignment -> `=' explist1 */ -- cgit v1.2.3-55-g6feb