libp2p / libp2p/go-libp2p

panic: runtime error: slice bounds out of range

Open
#2,444 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

need/analysis need/author-input
Dominant language
Go
Stars
6.9k
Forks
1.3k
Avg merge
13d 21h
Merged PRs (30d)
1

Description

v0.24.2


```shell
caught panic: runtime error: slice bounds out of range [:19] with capacity 1
goroutine 2503483111 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/multiformats/go-multistream.SelectWithSimopenOrFail.func1()
pkg/mod/github.com/multiformats/go-multistream@v0.3.3/client.go:103 +0x58
panic({0x26c3f20, 0xc017c6a4f8})
/usr/local/go/src/runtime/panic.go:838 +0x207
github.com/libp2p/go-libp2p/p2p/net/pnet.(*pskConn).Read(0xc0b72b09c0, {0xc05920ab90, 0x10?, 0x1})
pkg/mod/github.com/libp2p/go-libp2p@v0.24.2/p2p/net/pnet/psk_conn.go:43 +0x185
github.com/multiformats/go-multistream.(*byteReader).ReadByte(0xc04ebcd770)
pkg/mod/github.com/multiformats/go-multistream@v0.3.3/multistream.go:328 +0x4e
github.com/multiformats/go-varint.ReadUvarint({0x385c7e0, 0xc04ebcd770})
pkg/mod/github.com/multiformats/go-varint@v0.0.7/varint.go:80 +0x5a
github.com/multiformats/go-multistream.lpReadBuf({0x21b2748ca18?, 0xc0b72b09c0})
pkg/mod/github.com/multiformats/go-multistream@v0.3.3/multistream.go:292 +0x94
github.com/multiformats/go-multistream.ReadNextTokenBytes({0x21b2748ca18?, 0xc0b72b09c0?})
pkg/mod/github.com/multiformats/go-multistream@v0.3.3/multistream.go:275 +0x27
github.com/multiformats/go-multistream.ReadNextToken(...)
pkg/mod/github.com/multiformats/go-multistream@v0.3.3/multistream.go:264
github.com/multiformats/go-multistream.SelectWithSimopenOrFail({0xc000cbfae0?, 0x2, 0x2}, {0x21b2748c9e8?, 0xc0b72b09c0})
pkg/mod/github.com/multiformats/go-multistream@v0.3.3/client.go:128 +0x1e5
github.com/libp2p/go-libp2p/p2p/net/upgrader.(*upgrader).negotiateSecurity.func1()
pkg/mod/github.com/libp2p/go-libp2p@v0.24.2/p2p/net/upgrader/upgrader.go:327 +0x167
created by github.com/libp2p/go-libp2p/p2p/net/upgrader.(*upgrader).negotiateSecurity
pkg/mod/github.com/libp2p/go-libp2p@v0.24.2/p2p/net/upgrader/upgrader.go:318 +0x112
```

Receive error a day or two later.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with p2p/net/pnet/psk_conn.go at line 43 and trace the stack through go-multistream's client.go and multistream.go using the v0.24.2 panic report. Reproduce the slice-bounds panic during security negotiation, identify the failing read path, and verify that the panic no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.