gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: do not crash on odd inputs


From: gnunet
Subject: [taler-exchange] branch master updated: do not crash on odd inputs
Date: Thu, 26 Mar 2020 19:25:37 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new e63d3121 do not crash on odd inputs
e63d3121 is described below

commit e63d3121314c7238930c55d40673640e327f964c
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Mar 26 19:25:35 2020 +0100

    do not crash on odd inputs
---
 src/lib/exchange_api_deposit.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 8c00effc..4ef76c88 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -148,7 +148,11 @@ auditor_cb (void *cls,
   key_state = TALER_EXCHANGE_get_keys (dh->exchange);
   spk = TALER_EXCHANGE_get_signing_key_info (key_state,
                                              &dh->exchange_pub);
-  GNUNET_assert (NULL != spk);
+  if (NULL == spk)
+  {
+    GNUNET_break_op (0);
+    return NULL;
+  }
   TALER_amount_ntoh (&amount_without_fee,
                      &dh->depconf.amount_without_fee);
   aie = GNUNET_new (struct TEAH_AuditorInteractionEntry);
@@ -544,7 +548,11 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle 
*exchange,
   }
   (void) GNUNET_TIME_round_abs (&wire_deadline);
   (void) GNUNET_TIME_round_abs (&refund_deadline);
-  GNUNET_assert (refund_deadline.abs_value_us <= wire_deadline.abs_value_us);
+  if (refund_deadline.abs_value_us > wire_deadline.abs_value_us)
+  {
+    GNUNET_break (0);
+    return NULL;
+  }
   GNUNET_assert (GNUNET_YES ==
                  TEAH_handle_is_ready (exchange));
   /* initialize h_wire */
@@ -558,11 +566,19 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle 
*exchange,
   key_state = TALER_EXCHANGE_get_keys (exchange);
   dki = TALER_EXCHANGE_get_denomination_key (key_state,
                                              denom_pub);
-  GNUNET_assert (NULL != dki);
-  GNUNET_assert (GNUNET_SYSERR !=
-                 TALER_amount_subtract (&amount_without_fee,
-                                        amount,
-                                        &dki->fee_deposit));
+  if (NULL == dki)
+  {
+    GNUNET_break (0);
+    return NULL;
+  }
+  if (GNUNET_SYSERR ==
+      TALER_amount_subtract (&amount_without_fee,
+                             amount,
+                             &dki->fee_deposit))
+  {
+    GNUNET_break_op (0);
+    return NULL;
+  }
   GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
                                      &denom_pub_hash);
   if (GNUNET_OK !=

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]