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

p2p: remove explicit compact size limit

Public commit record

What the developer wrote

Authored by Nick Johnson

80/100 · Strong
p2p: remove explicit compact size limit

These limit overrides are unnecessary because both types,
`PrefilledTransaction.idx` and `Offset`, are u16's under the hood. The
decoding will fail on too large of values when the type conversion
is attempted in `::end()`.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit removes an explicit 4-million-item size limit when decoding two compact-size numbers in Bitcoin compact block (BIP-152) messages. The author argues the limit is unnecessary because the decoded values are ultimately stored as 16-bit unsigned integers (u16), so any value larger than 65,535 will already be rejected later in the decoding process. The change is a code simplification rather than a clear security fix, but it slightly shifts where and how oversized inputs are rejected.

Recommended action

Verify that CompactSizeDecoder::new() without a limit still rejects values above the u16 range (0..=65535) cleanly via the decoder's ::end() or equivalent conversion, and that error handling surfaces the failure rather than truncating or panicking. Consider adding a regression test for values 65536..=4000000 to confirm the intended behavior. No urgent patch is indicated unless verification shows the downstream check is missing or unsafe.

Security signals we found

01

Removal of an explicit anti-DoS decoding limit

02

Reliance on downstream type conversion (u16) to enforce the effective bound

03

Change in defense-in-depth: single enforcement point instead of layered limits

Risk score

Why this scored 29/100

Our methodology →
Potential impact 5/30
Exploitability 5/25
Stealth signal 5/15
Affected reach 5/15
Confidence 6/10
Evidence quality 3/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.