commit 0641151f6d83a013170fbc6c5282c59731d0057c parent 712e86843ae40d0fad5dffedbe5dcae1d0d93eb2 Author: Christian Grothoff <christian@grothoff.org> Date: Sat, 10 Oct 2026 15:00:35 +0200 add overflow check Diffstat:
| M | src/util/amount_quantity.c | | | 6 | ++++-- |
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/util/amount_quantity.c b/src/util/amount_quantity.c @@ -359,8 +359,10 @@ TALER_MERCHANT_amount_multiply_by_quantity ( &final_value, &final_fraction); - /* Check for overflow */ - if (0 != q_hi) + /* Check for overflow. Note that a `struct TALER_Amount` can only + represent values up to #TALER_AMOUNT_MAX_VALUE! */ + if ( (0 != q_hi) || + (final_value > TALER_AMOUNT_MAX_VALUE) ) return GNUNET_NO; result->value = final_value;