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

Merge rust-bitcoin/rust-bitcoin#6880: primitives: Fix OutPoint serde vout endianness

Public commit record

What the developer wrote

Authored by Andrew Poelstra

91/100 · Strong
Merge rust-bitcoin/rust-bitcoin#6880: primitives: Fix OutPoint serde vout endianness

674198e595d8192eeb85703018153b24835957fe primitives: Test OutPoint serde endianness (Jamil Lambert, PhD)
40528b9741099b14684aea5cf9cfcd6c130dc4eb primitives: Fix OutPoint serde vout endianness (Jamil Lambert, PhD)

Pull request description:

The non-human-readable `OutPoint` serializer writes `vout` as `u32::to_le_bytes()`, but the sequence visitor deserialized the field directly as a `u32`. Under a serializer whose integer byte order or width differs from those fixed little-endian bytes (for example bincode's big-endian or varint modes) the roundtrip returns the wrong `vout`, or fails. The map visitor already reads `[u8; 4]` and calls `u32::from_le_bytes`.

Read the `vout` field as `[u8; 4]` and decode it with `u32::from_le_bytes` in the sequence visitor, matching the serializer and the map visitor.

Closes project-loupe/audit-rust-bitcoin#126


ACKs for top commit:
apoelstra:
ACK 674198e595d8192eeb85703018153b24835957fe; successfully ran local tests
tcharding:
ACK 674198e595d8192eeb85703018153b24835957fe


Tree-SHA512: f56bc45dc2d794ed1ed32421834487f35adeeaab06b717e30dec141c13a6c963ad563ca74b25153ca4351de1bd2f404ea258fb42aac6484ff8bca84d12e875ec
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a serialization bug in how the `OutPoint` type (a Bitcoin transaction output identifier) handles its `vout` number when using non-human-readable serde formats. The code was writing `vout` as fixed little-endian bytes but reading it back as a generic integer, which could corrupt or fail deserialization under formats that use big-endian or variable-length integers. The fix makes the reader match the writer by always decoding four little-endian bytes. A regression test using bincode in big-endian mode was added.

Recommended action

Review whether any persisted serialized `OutPoint` data was produced by affected code paths with non-little-endian serde configurations, and consider whether downstream users relying on bincode big-endian or varint modes need a compatibility note. The fix itself should be backported to maintained release branches.

Security signals we found

01

Data integrity / roundtrip failure in serialized identifiers

02

Endianness mismatch between serializer and deserializer

03

Potential consensus-critical field corruption (OutPoint vout)

04

Regression test added for non-default serde backend

Risk score

Why this scored 38/100

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