]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: hlua: make hlua_ctx_renew() safe
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 8 Oct 2024 09:34:10 +0000 (11:34 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 8 Oct 2024 10:00:36 +0000 (12:00 +0200)
commitd0e01051813bde5cb06bebe88102f2b2885b3dea
tree635346fa7e484bff14d0269948adb06101e1238a
parent3f4a788329378168b0e9fee8c717a472e7c8ce01
BUG/MEDIUM: hlua: make hlua_ctx_renew() safe

hlua_ctx_renew() is called from unsafe places where the caller doesn't
expect it to LJMP.. however hlua_ctx_renew() makes use of Lua library
function that could potentially raise errors, such as lua_newthread(),
and it does nothing to catch errors. Because of this, haproxy could
unexpectedly crash. This was discovered and reported by GH user
@JB0925 on #2745.

To fix the issue, let's simply make hlua_ctx_renew() safe by applying
the same logic implemented for hlua_ctx_init() or hlua_ctx_destroy(),
which is catching Lua errors by leveraging SET_SAFE_LJMP_PARENT() helper.

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