View Issue Details

IDProjectCategoryView StatusLast Update
0012192Talerexchangepublic2026-11-18 15:02
Reporterbot-cg [agent]  
PrioritynormalSeverityminor 
Status new 
Summary0012192: libtalerexchange: since 2a57cbcaf, a coin history with a MELT entry that has no transfer_pubs is rejected as a whole
Description2a57cbcaf added to parse_melt() (exchange_api_get-coins-COIN_PUB-history.c) a check num_transfer_pubs != num_fresh_coins after parsing. transfer_pubs is optional, though: the exchange omits it for legacy v27 melts (taler-exchange-httpd_get-coins-COIN_PUB-history.c only packs it when melt->transfer_pubs is non-NULL, and do_refresh.c asserts that v27 melts have none), and the public header documents transfer_pubs as NULL in that case. When the field is absent, num_transfer_pubs is 0 and the new check rejects the entry, and with it the whole coin history. It also makes the 'protocol < 46' tolerance in testing_api_cmd_coin_history.c unreachable.

When transfer_pubs is present with the wrong length, the pre-check at the top of parse_melt() (from 007dd603b) already rejects it, so the new check adds nothing in that case.

The attached patch marks the optional field with a flag and applies the length check only when transfer_pubs was present.
TagsNo tags attached.
Attached Files
12192-libexchange-accept-MELT-history-entries-without-tran.patch (1,968 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: accept MELT history entries without
 transfer_pubs again

The exchange omits transfer_pubs for legacy melts, and a mismatched
length is already refused by the check at the start of parse_melt().

Issue: https://bugs.taler.net/n/12192

Assisted by LLM
---
 src/lib/exchange_api_get-coins-COIN_PUB-history.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lib/exchange_api_get-coins-COIN_PUB-history.c b/src/lib/exchange_api_get-coins-COIN_PUB-history.c
index dfb6a728f..f1cf9f780 100644
--- a/src/lib/exchange_api_get-coins-COIN_PUB-history.c
+++ b/src/lib/exchange_api_get-coins-COIN_PUB-history.c
@@ -286,6 +286,7 @@ parse_melt (struct CoinHistoryParseContext *pc,
     struct TALER_DenominationHashP *denoms_h = NULL;
     struct TALER_TransferPublicKeyP *transfer_pubs = NULL;
     size_t num_transfer_pubs = 0;
+    bool no_transfer_pubs;
     struct GNUNET_JSON_Specification spec[] = {
       TALER_JSON_spec_amount_any ("melt_fee",
                                   &rh->details.melt.melt_fee),
@@ -315,7 +316,7 @@ parse_melt (struct CoinHistoryParseContext *pc,
                                        sizeof (struct TALER_TransferPublicKeyP),
                                        &num_transfer_pubs,
                                        (void **) &transfer_pubs),
-        NULL),
+        &no_transfer_pubs),
       GNUNET_JSON_spec_end ()
     };
 
@@ -327,7 +328,8 @@ parse_melt (struct CoinHistoryParseContext *pc,
       GNUNET_break_op (0);
       return GNUNET_SYSERR;
     }
-    if (num_transfer_pubs != rh->details.melt.num_fresh_coins)
+    if ( (! no_transfer_pubs) &&
+         (num_transfer_pubs != rh->details.melt.num_fresh_coins) )
     {
       GNUNET_break_op (0);
       GNUNET_JSON_parse_free (spec);
-- 
2.47.3

Required notifications

Address or linkRemarkAdded byNotifiedActions

Relationships

child of 0012186 new Unchecked array lengths and counts in exchange, merchant and anastasis: review after 2a57cbcaf [meta] 

Activities

Issue History

Date ModifiedUsernameFieldChange
2026-11-18 15:01bot-cgNew Issue
2026-11-18 15:01bot-cgRelationship addedchild of 0012186
2026-11-18 15:01bot-cgImplementer => oec
2026-11-18 15:01bot-cgReviewer => Christian Grothoff
2026-11-18 15:01bot-cgRelease signed by => Florian Dold
2026-11-18 15:01bot-cgDeployed by => Christian Grothoff
2026-11-18 15:01bot-cgVerifier => oec
2026-11-18 15:01bot-cgCommunicator => CM_7
2026-11-18 15:02bot-cgFile Added: 12192-libexchange-accept-MELT-history-entries-without-tran.patch