Skip to content

bufio: panic when write to file use bufio #70025

@liaoyann

Description

@liaoyann

Go version

go version go1.23.1 windows/amd64

Output of go env in your module/workspace:

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\x\AppData\Local\go-build
set GOENV=C:\Users\x\AppData\Roaming\go\env  
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.com.cn,direct
set GOROOT=D:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=D:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23.1
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\x\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=xxx -gno-record-gcc-switches

What did you do?

write to file use writer.Write

_, err := c.writer.Write(message)

What did you see happen?

panic: runtime error: slice bounds out of range [:4124] with capacity 4096

goroutine 40723 [running]:
bufio.(*Writer).Flush(0x69cd7c?)
/data/software/go1.20.5/src/bufio/bufio.go:628 +0x185
bufio.(*Writer).Write(0xc0002b1b80, {0xc000183000?, 0xc0002e5bb8?, 0x6?})
/data/software/go1.20.5/src/bufio/bufio.go:672 +0xd0
rgs/record.(*RecordClient).WriteToFile(0xc00069c930, 0x2, {0xc000183000, 0xcaf, 0x1000})

What did you expect to see?

wite to file

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions