]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: hlua: unsafe hlua_lua2smp() usage
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 17 May 2023 14:06:11 +0000 (16:06 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 24 May 2023 14:48:17 +0000 (16:48 +0200)
commit1c07da4b48f680f0de871b2a87a21c1dd05a1ed9
treec4957ed9c0c3b891a92fd417f63b60ca27d2cce1
parenta3624cb52850754212a57952fb38da03bed2938c
BUG/MINOR: hlua: unsafe hlua_lua2smp() usage

Fixing hlua_lua2smp() usage in hlua's code since it was assumed that
hlua_lua2smp() makes a standalone smp out of lua data, but it is not
the case.

This is especially true when dealing with lua strings (string is
extracted using lua_tolstring() which returns a pointer to lua string
memory location that may be reclaimed by lua at any time when no longer
used from lua's point of view). Thus, smp generated by hlua_lua2smp() may
only be used from the lua context where the call was initially made, else
it should be explicitly duplicated before exporting it out of lua's
context to ensure safe (standalone) usage.

This should be backported to all stable versions.
src/hlua.c