BUG/MINOR: hlua: fix unsafe lua_tostring() usage with empty stack

Lua documentation says that lua_tostring() returns a pointer that remains
valid as long as the object is not removed from the stack.

However there are some places were we use the returned string AFTER the
corresponding object is removed from the stack. In practise this doesn't
seem to cause visible bugs (probably because the pointer remains valid
waiting for a GC cycle), but let's fix that to comply with the
documentation and avoid undefined behavior.

It should be backported in all stable versions.

(cherry picked from commit 5508db9a20d995804edccd48144292ab1b8d8b08)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f4dc0816327b446ad4af63d458c9f9bfdbf9fc53)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 93361a59ff27132c1a151ab5480713e74be4fb42)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit bb913d77b4678691460009bd3a040cb677b6d0bf)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 72d755a063261ccb02b5cbf2f2ad5b5e23b9cd4a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed