blob: 4229eeb06c3fa5a66d2ceb06eef1fc090535e5c0 [file] [log] [blame]
Frédéric Lécaille153b2b62018-06-18 19:32:10 +02001# commit f874a83
2# BUG/MINOR: lua: Segfaults with wrong usage of types.
3#
4# Patrick reported that this simple configuration made haproxy segfaults:
5#
6# global
7# lua-load /tmp/haproxy.lua
8#
9# frontend f1
10# mode http
11# bind :8000
12# default_backend b1
13#
14# http-request lua.foo
15#
16# backend b1
17# mode http
18# server s1 127.0.0.1:8080
19#
20# with this '/tmp/haproxy.lua' script:
21#
22# core.register_action("foo", { "http-req" }, function(txn)
23# txn.sc:ipmask(txn.f:src(), 24, 112)
24# end)
25#
26# This is due to missing initialization of the array of arguments
27# passed to hlua_lua2arg_check() which makes it enter code with
28# corrupted arguments.
29#
30# Thanks a lot to Patrick Hemmer for having reported this issue.
31
32
33varnishtest "Basic LUA test h00000"
34feature ignore_unknown_macro
35
36server s1 -repeat 2 {
37 rxreq
38 txresp
39} -start
40
41haproxy h1 -conf {
42 global
Frédéric Lécaille99316342018-08-22 10:41:33 +020043 lua-load ${testdir}/b00000.lua
Frédéric Lécaille153b2b62018-06-18 19:32:10 +020044
45 frontend fe1
46 mode http
47 bind "fd@${fe1}"
48 default_backend b1
49
50 http-request lua.foo
51
52 backend b1
53 mode http
54 server s1 ${s1_addr}:${s1_port}
55
56} -start
57
58client c0 -connect ${h1_fe1_sock} {
59 txreq -url "/foo"
60 rxresp
61 expect resp.status == 200
62}
63
64client c1 -connect ${h1_fe1_sock} {
65 txreq -url "/foo"
66 rxresp
67 expect resp.status == 200
68}
69
70client c0 -start
71client c1 -start
72
73client c0 -wait
74client c1 -wait