Browse Source

buffer creation ensures buffer space plus MINSTACK in the stack

Roberto Ierusalimschy 16 years ago
parent
commit
189378142a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lauxlib.c

+ 2 - 1
lauxlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lauxlib.c,v 1.179 2008/07/03 14:21:41 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.180 2009/02/13 19:39:34 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 */
@@ -355,6 +355,7 @@ LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
 
 
 LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
+  luaL_checkstack(L, LIMIT + LUA_MINSTACK, "no space for new buffer");
   B->L = L;
   B->p = B->buffer;
   B->lvl = 0;