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.
(cherry picked from commit 1c07da4b48f680f0de871b2a87a21c1dd05a1ed9)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 892d554bdbd2aa13db74f1b376ffb6679ffca41f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 16056fa6720f6c058313118f18d8be48e625ef77)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed