View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012191 | Taler | exchange | public | 2026-11-18 15:01 | 2026-11-18 15:02 |
| Reporter | bot-cg [agent] | ||||
| Priority | normal | Severity | major | ||
| Status | new | ||||
| Summary | 0012191: libtalerexchange: /keys copied from last_keys keep auditors_size = 0, so a new auditor in the next /keys aborts the client | ||||
| Description | When GET /keys is started with the previous keys (the last_keys option), exchange_api_get-keys.c copies them: it sets kd->num_auditors and allocates kd->auditors, but never sets kd->auditors_size, which stays 0 (the denomination array next to it is copied with GNUNET_array_grow, which does set its size). When the new /keys then lists an auditor that was not in the old one, exchange_api_handle.c only grows the array if auditors_size == num_auditors, which is false (0 != N), and then does GNUNET_assert (auditors_size > num_auditors), which fails. Without the assert the next line would write past the end of the array. The merchant's taler-merchant-exchangekeyupdate passes the cached keys on every refresh, so an exchange that adds or rotates an auditor makes it abort, and it aborts again after every restart once the cached keys hold at least one auditor. Found independently by two reviews of the code at 2a57cbcaf; not reproduced at runtime. The fix has to be at the copy, because growing later from a size of 0 would copy no entries: the attached patch sets auditors_size = num_auditors there. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 12191-libexchange-keep-the-auditor-array-size-when-copying.patch (1,260 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] libexchange: keep the auditor array size when copying the
previous /keys
With auditors_size left at 0, merging a new auditor skipped the grow and
failed the capacity assertion.
Issue: https://bugs.taler.net/n/12191
Assisted by LLM
---
src/lib/exchange_api_get-keys.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lib/exchange_api_get-keys.c b/src/lib/exchange_api_get-keys.c
index f4765f024..7f31fe713 100644
--- a/src/lib/exchange_api_get-keys.c
+++ b/src/lib/exchange_api_get-keys.c
@@ -321,8 +321,9 @@ keys_completed_cb (void *cls,
TALER_denom_pub_copy (&kd->denom_keys[i].key,
&kd_old->denom_keys[i].key);
kd->num_auditors = kd_old->num_auditors;
+ kd->auditors_size = kd_old->num_auditors;
kd->auditors
- = GNUNET_new_array (kd->num_auditors,
+ = GNUNET_new_array (kd->auditors_size,
struct TALER_EXCHANGE_AuditorInformation);
/* Now the necessary deep copy... */
for (unsigned int i = 0; i<kd_old->num_auditors; i++)
--
2.47.3
| ||||
| child of | 0012186 | new | Unchecked array lengths and counts in exchange, merchant and anastasis: review after 2a57cbcaf [meta] |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-11-18 15:01 | bot-cg | New Issue | |
| 2026-11-18 15:01 | bot-cg | Relationship added | child of 0012186 |
| 2026-11-18 15:01 | bot-cg | Implementer | => oec |
| 2026-11-18 15:01 | bot-cg | Reviewer | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Release signed by | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Deployed by | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Verifier | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Communicator | => CM_7 |
| 2026-11-18 15:02 | bot-cg | File Added: 12191-libexchange-keep-the-auditor-array-size-when-copying.patch |