MINOR: hlua: hlua_arg2lua() may LJMP

Add LJMP hint to hlua_arg2lua() prototype since it relies on
functions (e.g.: lua_pushlstring()) which may raise lua memory errors.
This commit is contained in:
Aurelien DARRAGON 2023-05-17 10:51:50 +02:00 committed by Christopher Faulet
parent 4121772c50
commit e5c048a72d
1 changed files with 4 additions and 4 deletions

View File

@ -506,7 +506,7 @@ DECLARE_STATIC_POOL(pool_head_hlua_event_sub, "hlua_esub", sizeof(struct hlua_ev
* LUA stack contains arguments according with an required ARG_T * LUA stack contains arguments according with an required ARG_T
* format. * format.
*/ */
static int hlua_arg2lua(lua_State *L, const struct arg *arg); __LJMP static int hlua_arg2lua(lua_State *L, const struct arg *arg);
static int hlua_lua2arg(lua_State *L, int ud, struct arg *arg); static int hlua_lua2arg(lua_State *L, int ud, struct arg *arg);
__LJMP static int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp, __LJMP static int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
uint64_t mask, struct proxy *p); uint64_t mask, struct proxy *p);
@ -764,7 +764,7 @@ static int hlua_pusherror(lua_State *L, const char *fmt, ...)
* It takes an array of "arg", and each entry of the array is * It takes an array of "arg", and each entry of the array is
* converted and pushed in the LUA stack. * converted and pushed in the LUA stack.
*/ */
static int hlua_arg2lua(lua_State *L, const struct arg *arg) __LJMP static int hlua_arg2lua(lua_State *L, const struct arg *arg)
{ {
switch (arg->type) { switch (arg->type) {
case ARGT_SINT: case ARGT_SINT:
@ -9721,7 +9721,7 @@ static int hlua_sample_conv_wrapper(const struct arg *arg_p, struct sample *smp,
RESET_SAFE_LJMP(stream->hlua); RESET_SAFE_LJMP(stream->hlua);
return 0; return 0;
} }
hlua_arg2lua(stream->hlua->T, arg_p); MAY_LJMP(hlua_arg2lua(stream->hlua->T, arg_p));
stream->hlua->nargs++; stream->hlua->nargs++;
} }
} }
@ -9857,7 +9857,7 @@ static int hlua_sample_fetch_wrapper(const struct arg *arg_p, struct sample *smp
RESET_SAFE_LJMP(stream->hlua); RESET_SAFE_LJMP(stream->hlua);
return 0; return 0;
} }
hlua_arg2lua(stream->hlua->T, arg_p); MAY_LJMP(hlua_arg2lua(stream->hlua->T, arg_p));
stream->hlua->nargs++; stream->hlua->nargs++;
} }