Commit 9f2f390
fix: resolve signed integer overflow UB in CoinJoin priority and timeout
CalculateAmountPriority in common.h could overflow when assigning a
negated int64_t division result to an int return type with extreme
CAmount values. Add a MoneyRange guard to return 0 for out-of-range
inputs, as CoinJoin amounts are always within valid money range.
IsTimeOutOfBounds in coinjoin.cpp could overflow on signed subtraction
when current_time and nTime are extreme values. Add a guard rejecting
negative timestamps (which are always invalid) so the original
subtraction logic is safe for all remaining non-negative inputs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 1d212a1 commit 9f2f390
2 files changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| |||
0 commit comments