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

fix: InstructionIndices::nth byte position bug

Public commit record

What the developer wrote

Authored by Alexey Gradoboev

100/100 · Strong
fix: InstructionIndices::nth byte position bug

Remove the custom `nth` implementation for `InstructionIndices` because
it captures position via `next_with` and returns as byte offset instead of advancing it in later next_fn calls.

Fixes #6377
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug in a Rust Bitcoin library iterator that reports byte positions of script instructions. The custom `nth` method incorrectly returned the byte offset of the found instruction without updating the iterator's internal position, so later calls to advance the iterator would report wrong positions. Removing the custom `nth` lets the normal iterator machinery keep positions correct. The practical security impact is limited because it is a correctness bug in reporting indices, not a direct memory-safety or cryptographic flaw, but code relying on these indices could make wrong decisions.

Recommended action

Treat as a correctness fix with low-to-moderate security relevance. Review any code that calls `.nth()` on `InstructionIndices` and then continues iteration, as prior indices would have been wrong. No immediate emergency response is warranted unless downstream components use these indices for security-sensitive bounds or validation decisions.

Security signals we found

01

Iterator state corruption in a public API

02

Incorrect byte-index reporting for Bitcoin script instructions

03

Potential downstream logic errors if indices are used for parsing or validation

04

No direct memory safety, cryptographic, or consensus-critical signal in the diff

Risk score

Why this scored 35/100

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