]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: hlua: fix unsafe lua_tostring() usage with empty stack
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 1 Mar 2024 18:54:16 +0000 (19:54 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Mon, 4 Mar 2024 15:46:53 +0000 (16:46 +0100)
commit5508db9a20d995804edccd48144292ab1b8d8b08
tree51a4d814d236e20baaa7a51be9ed1376bfdd7d49
parent7151076522eface09dc3268e9d12286ff570e9b0
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.
src/hlua.c