Skip to content

bufio: 1.5.1 panic slice bounds out of range #12925

@semihalev

Description

@semihalev

Hi,

Today, i received panic from bufio reader. I used bufio for tcp connections. The function running for 30 days without problem.

Here is the sample code:

func TCPReader(connection *net.TCPConn) {
    reader := bufio.NewReaderSize(connection, 8192)

    header := make([]byte, 9)
    for {
        len, err := reader.Read(header[:])
    }
}

Panic Log:
panic: runtime error: slice bounds out of range

goroutine 490939 [running]:
bufio.(*Reader).Read(0xc828791f80, 0xc82858b670, 0x9, 0x9, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:214 +0x3c8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions