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

Stricter bounds validation in int call_get_merkle_leaf_index

Public commit record

What the developer wrote

Authored by Salvatore Ingala

50/100 · Thin
Stricter bounds validation in int call_get_merkle_leaf_index
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
The short version

What changed, and why it matters

This commit tightens validation in a Ledger Bitcoin app function that reads a Merkle tree leaf index from an external message. Previously, the function accepted any 64-bit unsigned index value. Now it rejects indexes larger than the maximum signed integer and indexes equal to or larger than the number of leaves. This prevents a malformed or hostile message from passing an out-of-range index into later code that expects a normal array position, which could otherwise cause incorrect behavior or memory corruption on a secure hardware wallet.

Recommended action

Treat this as a security hardening fix and include it in the next firmware release. Review all callers of `call_get_merkle_leaf_index()` to confirm they propagate the `-1` error and do not cast or truncate `index` elsewhere. Consider adding unit tests with boundary values (INT_MAX, INT_MAX+1, size-1, size, 0xFFFFFFFFFFFFFFFF) to prevent regression.

Security signals we found

01

Bounds check added for externally supplied varint index

02

Type-safety check against INT_MAX before likely signed-int use

03

Return -1 on validation failure consistent with existing error handling

04

Single-file, focused hardening change in security-critical hardware-wallet code

Risk score

Why this scored 61/100

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