]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: hlua: ambiguous lua_pushvalue with 0 index
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 29 Sep 2022 10:00:04 +0000 (12:00 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 30 Sep 2022 13:21:20 +0000 (15:21 +0200)
In function hlua_applet_http_send_response(), a pushvalue
is performed with index '0'.

But according to lua doc (https://www.lua.org/manual/5.3/manual.html#4.3):
"Note that 0 is never an acceptable index".

Adding a FIXME comment near to the pushvalue operation
so that this can get some chance to be reviewed later.

No backport needed.

src/hlua.c

index a64dcec7d9754f01bf4552ba6b357365b62c336d..aff2099cf52ccfe425b3ffa62818b304e7037075 100644 (file)
@@ -5372,6 +5372,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L)
        sl->info.res.status = http_ctx->status;
 
        /* Get the array associated to the field "response" in the object AppletHTTP. */
+       /* FIXME: according to Lua doc, 0 is considered to be invalid index? */
        lua_pushvalue(L, 0);
        if (lua_getfield(L, 1, "response") != LUA_TTABLE) {
                hlua_pusherror(L, "Lua applet http '%s': AppletHTTP['response'] missing.\n",