]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: lua: Segfaults with wrong usage of types.
authorFrédéric Lécaille <flecaille@haproxy.com>
Fri, 15 Jun 2018 11:56:04 +0000 (13:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Jun 2018 08:23:47 +0000 (10:23 +0200)
commitf874a83b57acce760b0e500bbee47115390f777d
treea4118c5ec1519b9c0b3c2d2a3f52d94eb22fde08
parent9db0fedb596c278558b526b520925a8ea3a160c1
BUG/MINOR: lua: Segfaults with wrong usage of types.

Patrick reported that this simple configuration made haproxy segfaults:

    global
        lua-load /tmp/haproxy.lua

    frontend f1
        mode http
        bind :8000
        default_backend b1

        http-request lua.foo

    backend b1
        mode http
        server s1 127.0.0.1:8080

with this '/tmp/haproxy.lua' script:

    core.register_action("foo", { "http-req" }, function(txn)
        txn.sc:ipmask(txn.f:src(), 24, 112)
    end)

This is due to missing initialization of the array of arguments
passed to hlua_lua2arg_check() which makes it enter code with
corrupted arguments.

Thanks a lot to Patrick Hemmer for having reported this issue.

Must be backported to 1.8, 1.7 and 1.6.
src/hlua.c