From 493b3fdd6505bc5e97acfbd9e1596b45d9033f11 Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 1 Apr 2014 15:51:23 -0300
Subject: added an 'api_check' for negative sizes in 'lua_checkstack'

---
 lapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lapi.c b/lapi.c
index ae0da8c4..516e1b2c 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lapi.c,v 2.200 2014/02/26 12:39:30 roberto Exp roberto $
+** $Id: lapi.c,v 2.201 2014/03/12 20:57:40 roberto Exp roberto $
 ** Lua API
 ** See Copyright Notice in lua.h
 */
@@ -94,6 +94,7 @@ LUA_API int lua_checkstack (lua_State *L, int size) {
   int res;
   CallInfo *ci = L->ci;
   lua_lock(L);
+  api_check(L, size >= 0, "negative 'size'");
   if (L->stack_last - L->top > size)  /* stack large enough? */
     res = 1;  /* yes; check is OK */
   else {  /* no; need to grow stack */
-- 
cgit v1.2.3-55-g6feb