BUG/MEDIUM: lua: longjmp function must be unregistered
the longjmp function must be unregistered when we leaves the function
who install it.
diff --git a/src/hlua.c b/src/hlua.c
index 2d3f1e2..31c7145 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -4137,6 +4137,7 @@
/* Check stack available size. */
if (!lua_checkstack(stream->hlua.T, 1)) {
SEND_ERR(stream->be, "Lua converter '%s': full stack.\n", fcn->name);
+ RESET_SAFE_LJMP(stream->hlua.T);
return 0;
}
@@ -4146,6 +4147,7 @@
/* convert input sample and pust-it in the stack. */
if (!lua_checkstack(stream->hlua.T, 1)) {
SEND_ERR(stream->be, "Lua converter '%s': full stack.\n", fcn->name);
+ RESET_SAFE_LJMP(stream->hlua.T);
return 0;
}
hlua_smp2lua(stream->hlua.T, smp);
@@ -4156,6 +4158,7 @@
for (; arg_p->type != ARGT_STOP; arg_p++) {
if (!lua_checkstack(stream->hlua.T, 1)) {
SEND_ERR(stream->be, "Lua converter '%s': full stack.\n", fcn->name);
+ RESET_SAFE_LJMP(stream->hlua.T);
return 0;
}
hlua_arg2lua(stream->hlua.T, arg_p);
@@ -4236,6 +4239,7 @@
/* Check stack available size. */
if (!lua_checkstack(stream->hlua.T, 2)) {
SEND_ERR(smp->px, "Lua sample-fetch '%s': full stack.\n", fcn->name);
+ RESET_SAFE_LJMP(stream->hlua.T);
return 0;
}
@@ -4245,6 +4249,7 @@
/* push arguments in the stack. */
if (!hlua_txn_new(stream->hlua.T, stream, smp->px)) {
SEND_ERR(smp->px, "Lua sample-fetch '%s': full stack.\n", fcn->name);
+ RESET_SAFE_LJMP(stream->hlua.T);
return 0;
}
stream->hlua.nargs = 1;
@@ -4254,10 +4259,12 @@
/* Check stack available size. */
if (!lua_checkstack(stream->hlua.T, 1)) {
SEND_ERR(smp->px, "Lua sample-fetch '%s': full stack.\n", fcn->name);
+ RESET_SAFE_LJMP(stream->hlua.T);
return 0;
}
if (!lua_checkstack(stream->hlua.T, 1)) {
SEND_ERR(smp->px, "Lua sample-fetch '%s': full stack.\n", fcn->name);
+ RESET_SAFE_LJMP(stream->hlua.T);
return 0;
}
hlua_arg2lua(stream->hlua.T, arg_p);
@@ -4476,6 +4483,7 @@
if (!lua_checkstack(s->hlua.T, 1)) {
SEND_ERR(px, "Lua function '%s': full stack.\n",
rule->arg.hlua_rule->fcn.name);
+ RESET_SAFE_LJMP(s->hlua.T);
return ACT_RET_CONT;
}
@@ -4486,6 +4494,7 @@
if (!hlua_txn_new(s->hlua.T, s, px)) {
SEND_ERR(px, "Lua function '%s': full stack.\n",
rule->arg.hlua_rule->fcn.name);
+ RESET_SAFE_LJMP(s->hlua.T);
return ACT_RET_CONT;
}
s->hlua.nargs = 1;
@@ -4495,6 +4504,7 @@
if (!lua_checkstack(s->hlua.T, 1)) {
SEND_ERR(px, "Lua function '%s': full stack.\n",
rule->arg.hlua_rule->fcn.name);
+ RESET_SAFE_LJMP(s->hlua.T);
return ACT_RET_CONT;
}
lua_pushstring(s->hlua.T, *arg);