[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [patch] fix stack use in command-line lua interpreter
 
- From: "Adam D. Moss" <adam@...>
 
- Date: Mon, 11 Apr 2005 12:39:13 +0100
 
Command-line lua would blow the lua stack if there were
more than about 20 command-line script arguments, because
of incorrect luaL_checkstack() call.  Patch to 5.1work5
attached.
Regards,
--Adam
--
Adam D. Moss   -   adam@gimp.org
Index: src/lua.c
===================================================================
--- src/lua.c	(revision 4070)
+++ src/lua.c	(working copy)
@@ -113,7 +113,7 @@
 static int getargs (lua_State *L, char *argv[], int n) {
   int i, narg;
   for (i=n+1; argv[i]; i++) {
-    luaL_checkstack(L, 1, "too many arguments to script");
+    luaL_checkstack(L, 1+1+1, "too many arguments to script");
     lua_pushstring(L, argv[i]);
   }
   narg = i-(n+1);  /* number of arguments to the script (not to `lua.c') */