Skip to content

[r3.4] cl/sentinel: fix panic on short attnets ENR entry#20493

Merged
AskAlexSharov merged 1 commit into
release/3.4from
alex/sentinel_bitvec_panic_34
Apr 11, 2026
Merged

[r3.4] cl/sentinel: fix panic on short attnets ENR entry#20493
AskAlexSharov merged 1 commit into
release/3.4from
alex/sentinel_bitvec_panic_34

Conversation

@AskAlexSharov

Copy link
Copy Markdown
Collaborator

Cherry-pick of #20492 to release/3.4.

Summary

Fixes a panic seen in the wild:

panic: runtime error: index out of range [4] with length 1
  cl/sentinel.(*Sentinel).findPeersForSubnets.func1
        cl/sentinel/discovery.go:80

A malformed/short attnets ENR entry decodes into a bitfield.Bitvector64 shorter than the expected 8 bytes, so indexing peerSubnets[subnetIdx/8] goes out of range when subnetIdx >= 8.

Adds a len(peerSubnets) == 8 guard at all three call sites in cl/sentinel/discovery.go.

A malformed attnets ENR can decode into a Bitvector64 shorter than
8 bytes, causing 'index out of range' panic in findPeersForSubnets
when indexing peerSubnets[subnetIdx/8]. Reject such nodes.
@AskAlexSharov AskAlexSharov merged commit 288083d into release/3.4 Apr 11, 2026
20 checks passed
@AskAlexSharov AskAlexSharov deleted the alex/sentinel_bitvec_panic_34 branch April 11, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants