]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: hlua: hook yield does not behave as expected
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 24 Nov 2022 08:51:40 +0000 (09:51 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:58:16 +0000 (08:58 +0200)
commit0ebd41ff50d2d8b67b9fd725230e4ae8b6d0bcda
tree24f46923e01d2c20259589d8ae4e6a6886ee8f04
parent32483ecaac4195f56910dd2dc3f18b1fe243b42e
BUG/MINOR: hlua: hook yield does not behave as expected

In function hlua_hook, a yieldk is performed when function is yieldable.

But the following code in that function seems to assume that the yield
never returns, which is not the case!

Moreover, Lua documentation says that in this situation the yieldk call
must immediately be followed by a return.

This patch adds a return statement after the yieldk call.
It also adds some comments and removes a needless lua_sethook call.

It could be backported to all stable versions, but it is not mandatory,
because even if it is undefined behavior this bug doesn't seem to
negatively affect lua 5.3/5.4 stacks.
src/hlua.c