From 728ff9459579894ef7fd861c90be6247831799be Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 10 Jan 2018 10:02:35 -0200
Subject: error handler in protected calls must be a function

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

(limited to 'lapi.c')

diff --git a/lapi.c b/lapi.c
index d6aaf8a8..142baf6a 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lapi.c,v 2.278 2017/12/06 18:08:03 roberto Exp roberto $
+** $Id: lapi.c,v 2.279 2017/12/08 17:28:25 roberto Exp roberto $
 ** Lua API
 ** See Copyright Notice in lua.h
 */
@@ -980,6 +980,7 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
     func = 0;
   else {
     StkId o = index2stack(L, errfunc);
+    api_check(L, ttisfunction(s2v(o)), "error handler must be a function");
     func = savestack(L, o);
   }
   c.func = L->top - (nargs+1);  /* function to be called */
-- 
cgit v1.2.3-55-g6feb