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

consensus_encoding: bump compact size default decoding limit

Public commit record

What the developer wrote

Authored by Nick Johnson

73/100 · Adequate
consensus_encoding: bump compact size default decoding limit

Bump the max decoding limit on the standard compact size decoder from
4MB to 32MB. This matches the value used in Core as the general anti-DoS
setting.

All current call sites across the crates are updated to use the old
default explicitly. They can be changed to use the new default if it
makes sense on a case by case basis.

This new default breaks on 16-bit machines since it doesn't fit in a
usize. The alternative would be to change the type to a u64 which sucks
for everyone else.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit changes the default maximum decoded size for a compact-size length prefix from 4 MB to 32 MB in the rust-bitcoin library. To avoid accidentally allowing larger memory allocations, every existing place that used the old default is switched to an explicit 4 MB limit. The change is framed as matching Bitcoin Core's anti-DoS setting, not as fixing a known vulnerability. It could affect how downstream code behaves if it relied on the old 4 MB default without setting its own limit.

Recommended action

Review any downstream code that constructs CompactSizeDecoder::new() directly and confirm it is acceptable for it to inherit the new 32 MB default. If stricter limits are needed, switch such call sites to CompactSizeDecoder::new_with_limit(). No immediate patch is required because existing internal uses retain their previous 4 MB limits.

Security signals we found

01

Change to resource/DoS decoding limit

02

Explicit preservation of old limits at all call sites

03

Reference to Bitcoin Core anti-DoS serialization limit

04

Potential downstream behavior change for code using CompactSizeDecoder::new() directly

Risk score

Why this scored 34/100

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