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

consensus_encoding: Error on byte-less end for VecDecoder

Public commit record

What the developer wrote

Authored by Mitchell Bagot

73/100 · Adequate
consensus_encoding: Error on byte-less end for VecDecoder

In the existing encoding, Vec<T> would error when attempting to decode
an empty byte slice (i.e. one without a length prefix). In the new
consensus_encoding crate, a VecDecoder successfully decodes a
completely empty byte slice as 0 length Vec<T>. This difference in
behaviour manifests in various decoders throughout the stack and thus
results in differences in decoding behaviour.

Throw Eof error in VecDecoder::end() if no length prefix has been
provided to the decoder.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a behavioral mismatch in a new Bitcoin data-decoding library. Previously, the new decoder would silently accept an empty byte slice as an empty list, while the older code rejected it because it lacked a length prefix. The change makes the new decoder reject empty inputs too, preventing subtle parsing differences that could affect how transactions or network messages are interpreted across versions.

Recommended action

Review other decoder types in `consensus_encoding` for similar lenient-empty-input behavior, add regression tests for truncated length prefixes, and ensure downstream consumers do not rely on the previous permissive behavior.

Security signals we found

01

Behavioral divergence between old and new consensus decoders

02

Silent acceptance of truncated/malformed empty inputs

03

Potential for malleability or deserialization inconsistency in transaction/message parsing

04

Fix adds explicit EOF validation at decoder finalization

Risk score

Why this scored 51/100

Our methodology →
Potential impact 12/30
Exploitability 10/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.