From: Vsevolod Stakhov Date: Sun, 5 Oct 2025 16:06:57 +0000 (+0100) Subject: [Fix] Fix HTML fuzzy cache key to prevent overwriting text cache X-Git-Tag: 3.14.0~87^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=abf179fdbf23cfd5dd1734501fdc3580c491208b;p=thirdparty%2Frspamd.git [Fix] Fix HTML fuzzy cache key to prevent overwriting text cache HTML fuzzy hashes were incorrectly cached using the standard text fuzzy cache key via fuzzy_cmd_set_cached(), causing HTML hashes to overwrite text hashes for the same part. Now HTML fuzzy uses the dedicated html_cache_key for both read and write operations, preventing cache conflicts and ensuring proper retrieval of HTML fuzzy data. --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 395fc2512a..5139783e56 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -2364,7 +2364,13 @@ fuzzy_cmd_from_html_part(struct rspamd_task *task, return NULL; } - fuzzy_cmd_set_cached(rule, task, mp, cached); + /* Save to HTML-specific cache (not standard text cache) */ + if (!html_cached_ptr) { + html_cached_ptr = rspamd_mempool_alloc0(task->task_pool, sizeof(*html_cached_ptr) * + (MESSAGE_FIELD(task, parts)->len + 1)); + rspamd_mempool_set_variable(task->task_pool, html_cache_key, html_cached_ptr, NULL); + } + html_cached_ptr[mp->part_number] = cached; } io = rspamd_mempool_alloc(task->task_pool, sizeof(*io));