]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] hs_helper: fix use-after-free in async hyperscan cache callbacks
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 29 Jan 2026 15:16:59 +0000 (15:16 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 29 Jan 2026 15:16:59 +0000 (15:16 +0000)
commit097beafc7e645909577eade8b202b3b701ee8e28
tree9285ca1356a99a442cb5d2cf8622f11289fc6a01
parentd492cf4fadcec739ae7bd3e0211d73110155663b
[Fix] hs_helper: fix use-after-free in async hyperscan cache callbacks

Add proper refcounting to async compilation contexts to prevent
use-after-free when Redis callbacks are invoked multiple times
(timeout + response) or during worker termination.

- Add ref_entry_t to async context structures
- Use REF_RETAIN before async operations and REF_RELEASE in callbacks
- Add callback_processed flag to prevent double processing
- Save entry data before ev_run that might free pending arrays
src/hs_helper.c
src/libserver/maps/map_helpers.c
src/libserver/re_cache.c
src/libutil/multipattern.c