View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012196 | Anastasis | C reducer implementation | public | 2026-11-18 15:01 | 2026-11-18 15:02 |
| Reporter | bot-cg [agent] | ||||
| Priority | normal | Severity | crash | Reproducibility | always |
| Status | new | ||||
| Product Version | Git master | ||||
| Summary | 0012196: reducer: 'next' in AUTHENTICATIONS_EDITING crashes when no provider offers one of the authentication methods | ||||
| Description | done_authentication() (anastasis_api_backup_redux.c) builds every combination of req_methods authentication methods and, in go_with(), looks for provider mappings for each; a combination for which no enabled provider offers all its methods ends up with an empty pm_head. select_policies() then calls find_best_map(), which only reaches evaluate_map() -- and so only fills in the stack array best[] -- when every policy has at least one mapping. If any policy has none, best[] is never written, but select_policies() still reads best[off].providers[i].provider_name for every policy and passes it to ANASTASIS_REDUX_provider_url_set_(), i.e. an uninitialised pointer goes to GNUNET_strdup(). This needs no malformed state: it happens whenever one of the user's authentication methods is of a type no enabled provider offers, or when all providers are disabled. The attached patch makes select_policies() fail with TALER_EC_ANASTASIS_REDUCER_AUTHENTICATION_METHOD_NOT_SUPPORTED when find_best_map() evaluated no complete mapping. | ||||
| Steps To Reproduce | Take src/cli/resources/04-backup.json (three 'question' methods, four providers) and change the type of the third authentication method to 'sms', or set every provider's status to 'disabled'. 'anastasis-reducer next' on it exits with SIGSEGV; valgrind reports 'Use of uninitialised value of size 8' at select_policies (anastasis_api_backup_redux.c:1445). With the patch it fails with error 8403 instead, valgrind reports nothing, and the unmodified 04-backup.json still advances to POLICIES_REVIEWING. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 12196-reducer-fail-when-no-provider-mapping-exists-for-a-p.patch (1,351 bytes)
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Wed, 18 Nov 2026 16:01:54 +0100
Subject: [PATCH] reducer: fail when no provider mapping exists for a policy
find_best_map() never fills in the best map in that case, and
select_policies() read provider names from uninitialized memory.
Issue: https://bugs.taler.net/n/12196
Assisted by LLM
---
src/reducer/anastasis_api_backup_redux.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c
index 4ef9978..1a329ef 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -1411,6 +1411,14 @@ select_policies (struct PolicyBuilder *pb)
"Assessed %u/%u policies\n",
pb->evaluations,
(unsigned int) MAX_EVALUATIONS);
+ if (0 == pb->evaluations)
+ {
+ /* Some policy has no provider mapping at all, so
+ find_best_map() never filled in @e best. */
+ pb->ec = TALER_EC_ANASTASIS_REDUCER_AUTHENTICATION_METHOD_NOT_SUPPORTED;
+ pb->hint = "no provider offers all of the selected authentication methods";
+ return;
+ }
off = 0;
for (struct Policy *p = pb->p_head;
NULL != p;
--
2.47.3
| ||||
| child of | 0012186 | new | Taler | Unchecked array lengths and counts in exchange, merchant and anastasis: review after 2a57cbcaf [meta] |