AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 38 Bitcoin

Fix overflow during *_ceil FeeRate conversions

Public commit record

What the developer wrote

Authored by Shing Him Ng

85/100 · Strong
Fix overflow during *_ceil FeeRate conversions

This fixes an overflow bug which occured when these ceil functions were
called on `FeeRate::MAX`, which is u64::MAX under the hood. This
resulted in the function panicking due to an overflow since part of the
ceil operation involves adding to the FeeRate before dividing by the
appropriate unit. By calling `saturating_add` instead of using `+`, this
prevents the function from panicking while preserving the expected
behavior when converting `FeeRate`s that would have previously
overflowed
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug in the rust-bitcoin library where three fee-rate conversion functions would crash when given the maximum possible fee rate. The functions round fee rates up to different units, and internally they added a small number before dividing. When the input was the maximum value (the largest 64-bit unsigned integer), that addition overflowed and caused a panic. The fix uses saturating addition, which caps the value instead of overflowing, so the functions now return a sensible result rather than crashing.

Recommended action

Review whether callers of these ceil functions may pass FeeRate::MAX or other large values, and ensure the saturating behavior is semantically acceptable for those callers. Consider adding checked variants if exact ceil semantics are required for non-maximum values. Update tests and documentation if needed.

Security signals we found

01

Integer overflow in unit conversion helpers

02

Panic/crash on maximum fee-rate input

03

Use of saturating_add to prevent overflow

04

New regression tests for boundary value

Risk score

Why this scored 38/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 6/15
Affected reach 7/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.