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

wallet2: clamp export_outputs start to the number of transfers

Public commit record

What the developer wrote

Authored by Cole Munz

81/100 · Strong
wallet2: clamp export_outputs start to the number of transfers

export_outputs() says start and count are allowed to go past the valid range,
and that nothing is returned when they do. The loop honours that, but offset
does not: with all=true it takes start unchecked, so a start past the end makes
m_transfers.size() - offset underflow and reserve() gets a value near SIZE_MAX.
vector::reserve throws std::length_error on that, which is where the
"vector::reserve" error in issue #8625 comes from.

Clamping offset also keeps the returned offset usable. import_outputs throws
when offset is past the total, so leaving offset at start would only move the
failure from export to import.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This is a small bug fix in Monero's wallet code. When exporting transaction outputs with a special 'all=true' flag, the code could be asked to start from a position beyond the list of stored transfers. That caused a subtraction to underflow (wrap around to a huge number), which made a memory reservation throw an exception with the message 'vector::reserve'. The fix clamps the starting position to the actual number of transfers, preventing the crash and keeping the returned data consistent with what the import function expects.

Recommended action

Apply the patch. It is a minimal, correct bounds clamp. Consider adding an explicit unit test for export_outputs with start >= m_transfers.size() and all=true to prevent regression. No immediate incident response is indicated because the failure mode is an exception, not memory corruption or unauthorized behavior.

Security signals we found

01

Integer underflow in size_t arithmetic leading to exception

02

Unchecked user/caller supplied offset in export_outputs

03

std::length_error / vector::reserve crash path

04

Fix aligns export behavior with documented allowance for start/count past valid range

Risk score

Why this scored 32/100

Our methodology →
Potential impact 8/30
Exploitability 4/25
Stealth signal 3/15
Affected reach 5/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.