commit 405c18675aec76a65854337ed9d075d469cf392a parent a445d05d81ee6481a60e91af684dce30a8d1e0d8 Author: Christian Grothoff <grothoff@gnunet.org> Date: Mon, 20 Jul 2026 00:04:02 +0200 do not crash on corrupt DB Diffstat:
| M | src/donaudb/iterate_submitted_receipts.c | | | 9 | +++++++-- |
| M | src/lib/donau_api_handle.c | | | 3 | --- |
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/donaudb/iterate_submitted_receipts.c b/src/donaudb/iterate_submitted_receipts.c @@ -71,8 +71,13 @@ DONAUDB_iterate_submitted_receipts ( total_donations); total_donations->value = valueSum; total_donations->fraction = fractionSum; - GNUNET_assert (GNUNET_OK == - TALER_amount_is_valid (total_donations)); + if (GNUNET_OK != + TALER_amount_is_valid (total_donations)) + { + /* Aggregated sum exceeds the representable amount range */ + GNUNET_break (0); + return GNUNET_DB_STATUS_HARD_ERROR; + } if (TALER_amount_is_zero (total_donations)) return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; return qs; diff --git a/src/lib/donau_api_handle.c b/src/lib/donau_api_handle.c @@ -929,9 +929,6 @@ DONAU_keys_from_json (const json_t *j) &compat)) { GNUNET_break (0); - /* decode_keys_json may already have allocated version/currency/ - sign_keys/donation_unit_keys before failing; free them all via - the regular refcounted destructor rather than leaking. */ keys->rc = 1; DONAU_keys_decref (keys); return NULL;