Module: kamailio
Branch: 5.0
Commit: a03a6ab7d7a1ab6e688ad3aeb7089803a695202c
URL:
https://github.com/kamailio/kamailio/commit/a03a6ab7d7a1ab6e688ad3aeb708980…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-02-12T08:47:00+01:00
app_lua: do lua_checkstack() to ensure enough capacity on Lua stack
- Lua doesn't do automatic management of the stack
*
http://www.lua.org/manual/5.1/manual.html#3.2
- do exit on insufficient capacity
- based on the report by GH #1433
(cherry picked from commit f6d69d87abdc48df22135c79ee2309248248ca8e)
(cherry picked from commit df9389a613e16f15b860af60222abe43ca367d09)
---
Modified: src/modules/app_lua/app_lua_sr.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a03a6ab7d7a1ab6e688ad3aeb708980…
Patch:
https://github.com/kamailio/kamailio/commit/a03a6ab7d7a1ab6e688ad3aeb708980…
---
diff --git a/src/modules/app_lua/app_lua_sr.c b/src/modules/app_lua/app_lua_sr.c
index 86380ec6ad..64ebafae40 100644
--- a/src/modules/app_lua/app_lua_sr.c
+++ b/src/modules/app_lua/app_lua_sr.c
@@ -1970,10 +1970,14 @@ void lua_sr_kemi_register_libs(lua_State *L)
}
n++;
}
+ if(!lua_checkstack(L, i+8)) {
+ LM_ERR("not enough Lua stack capacity\n");
+ exit(-1);
+ }
luaL_openlib(L, mname, _sr_crt_KSRMethods, 0);
- LM_DBG("initializing kemi sub-module: %s (%s)\n", mname,
- emods[k].kexp[0].mname.s);
+ LM_DBG("initializing kemi sub-module: %s (%s) (%d/%d/%d)\n", mname,
+ emods[k].kexp[0].mname.s, i, k, n);
}
}
- LM_DBG("module 'KSR' has been initialized\n");
+ LM_DBG("module 'KSR' has been initialized (%d/%d)\n", emods_size, n);
}