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

Avoid `Vec::with_capacity(huge)` on empty `Route`s

Public commit record

What the developer wrote

Authored by Matt Corallo

100/100 · Strong
Avoid `Vec::with_capacity(huge)` on empty `Route`s

In generally we consider empty `Route`s bogus garbage and don't
always handle them super carefully, but ideally we shouldn't
allocate a huge buffer just because someone passes a bogus `Route`
to an onion-building utility method.

Reported by Jordan Mecom of Block's Security Team

Test by Claude Opus 4.6
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug where a deliberately empty payment route could cause the software to try to reserve an enormous amount of memory. The fix makes the onion-packet builder reject empty routes immediately, preventing a potential denial-of-service or crash from an oversized memory allocation.

Recommended action

Treat as a low-to-moderate hardening fix. Review callers of `create_payment_onion` to ensure empty routes are not constructed elsewhere, and consider backporting to stable branches if the onion-building utilities are exposed to untrusted input.

Security signals we found

01

Denial-of-service vector: empty route could trigger massive memory allocation

02

Input validation added for empty payload vector

03

Error message changed to disclose that empty routes are now rejected

04

Reported by an external security team (Block's Security Team)

Risk score

Why this scored 44/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 5/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.