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

Fix overflow check in parse_unsigned_decimal

Public commit record

What the developer wrote

Authored by Salvatore Ingala

83/100 · Strong
Fix overflow check in parse_unsigned_decimal

Not all overflows were detected by the overflow check.
Fixed and added a regression test.

Also fixed the type discrepancy between uint32_t and size_t.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug in how the Ledger Bitcoin app reads large numbers from wallet policy strings. The old overflow check could miss some values that are too large to fit in a 32-bit unsigned integer, causing the app to silently accept and truncate an oversized number. This could let an attacker craft a wallet policy that passes validation when it should have been rejected, potentially changing the meaning of a spending condition such as a time lock. The fix corrects the math used to detect overflow and adds a regression test.

Recommended action

Treat this as a security-relevant bug fix. Review whether the fixed parser is used in any code path that accepts untrusted input, such as wallet policies received from a host. Ensure the regression test is run in CI and consider fuzzing parse_unsigned_decimal with boundary values.

Security signals we found

01

Integer overflow in a parser that validates wallet policies

02

Silent truncation could alter the semantics of a parsed policy

03

Affects miniscript/policy expressions such as `older(...)`

04

Regression test added for the overflow case

Risk score

Why this scored 62/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 10/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.