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

Fix decoder bug when ending before decoding prefix

Public commit record

What the developer wrote

Authored by Shing Him Ng

73/100 · Adequate
Fix decoder bug when ending before decoding prefix

Before this fix, calling `ByteVecDecoder.end()` on a decoder that hadn't
finished reading in the full prefix would result in a valid result of an
empty vec. This should instead result in an error, since the decoder
shouldn't be able to decode something with an incomplete prefix.
✓ 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 bug in a Bitcoin data decoder. Previously, if you stopped decoding early—before the full length prefix was read—the decoder would incorrectly report success with an empty result instead of reporting an error. The fix makes the decoder correctly return an 'unexpected end of data' error in those cases. This could matter for anyone parsing Bitcoin protocol data from partial or truncated inputs.

Recommended action

Review callers of ByteVecDecoder::end() to confirm they now handle UnexpectedEof correctly, and verify no code relied on the prior empty-Vec success behavior. Consider whether this bug could have caused silent truncation in any protocol parsing paths and add regression tests if not already present.

Security signals we found

01

Incorrect success on truncated/partial input

02

Missing input validation in decoder finalization

03

Potential for empty-vector misinterpretation by downstream callers

04

Fix adds explicit UnexpectedEof error path

Risk score

Why this scored 50/100

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