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

Make Witness FromIterator infallible

Public commit record

What the developer wrote

Authored by Mitchell Bagot

58/100 · Thin
Make Witness FromIterator infallible

The current Witness FromIterator impl uses the WitnessDecoder
internally. This was initially done as a means of reducing the
allocations needed to construct the type. However, for DoS protection,
the WitnessDecoder has various limitations that make it unsuitable for
infallible Witness construction. Instead, the old infallible solution
should be used, but tweaked to remove the previous per-item allocations
from the iterator collection.

Adjust the Witness FromIterator implementation to use a collect and
from_slice call to remove the incorrect function beyond the DoS
protection limits of the WitnessDecoder.
✓ Descriptive subject✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in how a Bitcoin data type called Witness is built from lists of byte slices. The previous code reused a decoder that has built-in denial-of-service limits, which could cause valid-looking witness lists to fail construction unexpectedly. The change makes the construction straightforward and infallible again, removing the risk that normal inputs hit those limits.

Recommended action

Review whether any callers relied on the decoder's DoS limits being enforced during FromIterator construction; if so, add explicit validation. Otherwise, include this fix in the next release and consider adding regression tests for large witness inputs constructed via FromIterator.

Security signals we found

01

Removal of expect() panic path in infallible trait implementation

02

DoS protection limits in decoder no longer applied during FromIterator construction

03

Use of infallible from_slice constructor instead of fallible decoder

04

Potential panic vector eliminated for large but otherwise valid witness inputs

Risk score

Why this scored 47/100

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