do not crash on odd inputs

This commit is contained in:
Christian Grothoff 2020-03-26 19:25:35 +01:00
parent 8fa6b996ed
commit e63d312131
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -148,7 +148,11 @@ auditor_cb (void *cls,
key_state = TALER_EXCHANGE_get_keys (dh->exchange); key_state = TALER_EXCHANGE_get_keys (dh->exchange);
spk = TALER_EXCHANGE_get_signing_key_info (key_state, spk = TALER_EXCHANGE_get_signing_key_info (key_state,
&dh->exchange_pub); &dh->exchange_pub);
GNUNET_assert (NULL != spk); if (NULL == spk)
{
GNUNET_break_op (0);
return NULL;
}
TALER_amount_ntoh (&amount_without_fee, TALER_amount_ntoh (&amount_without_fee,
&dh->depconf.amount_without_fee); &dh->depconf.amount_without_fee);
aie = GNUNET_new (struct TEAH_AuditorInteractionEntry); 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 (&wire_deadline);
(void) GNUNET_TIME_round_abs (&refund_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 == GNUNET_assert (GNUNET_YES ==
TEAH_handle_is_ready (exchange)); TEAH_handle_is_ready (exchange));
/* initialize h_wire */ /* initialize h_wire */
@ -558,11 +566,19 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
key_state = TALER_EXCHANGE_get_keys (exchange); key_state = TALER_EXCHANGE_get_keys (exchange);
dki = TALER_EXCHANGE_get_denomination_key (key_state, dki = TALER_EXCHANGE_get_denomination_key (key_state,
denom_pub); denom_pub);
GNUNET_assert (NULL != dki); if (NULL == dki)
GNUNET_assert (GNUNET_SYSERR != {
GNUNET_break (0);
return NULL;
}
if (GNUNET_SYSERR ==
TALER_amount_subtract (&amount_without_fee, TALER_amount_subtract (&amount_without_fee,
amount, amount,
&dki->fee_deposit)); &dki->fee_deposit))
{
GNUNET_break_op (0);
return NULL;
}
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key, GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
&denom_pub_hash); &denom_pub_hash);
if (GNUNET_OK != if (GNUNET_OK !=